Though there are many questions regarding this but i am still stuck.
I am using jqgrid 4.6 with loadonce true. I am trying to reload data from an external filter change event but i am not able to see that data in my grid.
I have also used below line to refresh still no success. This refresh do hits server method and returns JSON data. Which I am able to see in loadcomplete data param. When I hit the reload button in pager I can see data once. Afterwards hitting reload buttons also doesn’t hit server( I tried writing refresh code in beforerefresh event function, but it doesn’t even gets triggered)
1 |
<div class="sfcode"><span class="pln">jQuery</span><span class="pun">(</span><span class="str">"#RamTargetTable"</span><span class="pun">).</span><span class="pln">jqGrid</span><span class="pun">(</span><span class="str">'setGridParam'</span><span class="pun">,{</span><span class="pln">datatype</span><span class="pun">:</span><span class="str">'json'</span><span class="pun">}).</span><span class="pln">trigger</span><span class="pun">(</span><span class="str">'reloadGrid'</span><span class="pun">);</span></div> |
Below is the code
jQuery("#RamTargetTable").jqGrid({
url: '<%=Url.Content("~/RamTarget/GetTargetData")%>',
width: 1220,
height: 250,
datatype: "json",
colNames: [my column names],
colModel: [my model],
emptyrecords: 'No Turbines found for the selected Plant',
searchoptions: { searchhidden: true },
mtype: 'GET',
loadonce: true,
hidegrid: false,
rowList: [],
pager: '#RamTargetTablePager',
viewrecords: true,
caption: "RAM Targets",
pgbuttons: false,
pginput: false,
pgtext: null,
grouping: true,
groupingView: {
groupField: ['SerialNumber'],
groupColumnShow: [true],
hideFirstGroupCol: [true]
},
editurl: '<%=Url.Content("~/RamTarget/AddEditRamTargets")%>',
checkOnSubmit: false,
reloadAfterSubmit: true
});
$('#RamTargetTable').jqGrid('navGrid', '#RamTargetTablePager', { edit: false, add: false, del: false, search: true});
function SendPlantId() {
var plantId = $("#lstPlant").val() == null ? 0 : $("#lstPlant").val();
$.ajax({
url: '<%=Url.Content("~/RamTarget/FilterGrid")%>',
type: "post",
data: { id: plantId, filter: "Plant" },
success: function(data) {
jQuery("#RamTargetTable").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid');
}
});
}
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top