I have a grid that when I click the refresh button, it does nothing. No request made to the server. But I can see it executing the beforeRequest() function. Anyone knows what is going on?
jQuery("#paramlistFlex").jqGrid({
url: root + mod + '/setlistview',
datatype: "local",
colNames:[' ', 'Name of Set', 'Description of Set', 'Date of Set'],
colModel:[
{name:'myac', width:50, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true, editbutton : false, delbutton : false, delOptions: {reloadAfterSubmit:false},editOptions: {reloadAfterSubmit:false}}},
{name:'set_name',index:'set_name', width:200},
{name:'set_desc',index:'set_desc', width:400},
{name:'set_date',index:'set_date', width:200}
],
width: $('.body').width()-25,
height: ($('.body').height()-240)/2,
pager: '#pagerFlex2',
sortname: 'set_id',
sortorder: "desc",
editurl: root + mod + '/detailpost',
caption:"Set of Parameter List",
onSelectRow: function(id){
activedf = "#paramlistFlex";
},
afterInsertRow: function () {
var grid = $(this),
iCol = getColumnIndexByName(grid,'myac'); // 'act' - name of the actions column
grid.find(">tbody>tr.jqgrow>td:nth-child(" + (iCol + 1) + ")")
.each(function() {
if ($(this).find(">div>div").length == 2)
{
$("<div>",
{
title: "Delete",
mouseover: function() {
$(this).addClass('ui-state-hover');
},
mouseout: function() {
$(this).removeClass('ui-state-hover');
},
click: function(e) {
df_delete_1($(e.target).closest("tr.jqgrow").attr("id"));
}
}
).css({float:"left"})
.addClass("ui-pg-div ui-inline-edit")
.append('<span class="ui-icon ui-icon-trash"></span>')
.prependTo($(this).children("div"));
}
});
},
beforeRequest: function() {
var setid = $('input[name=item]').val();
if (setid == "")
setid = 0;
jQuery("#paramlistFlex").jqGrid('setGridParam',{postData:{setid: setid}});
console.log('hiya');
}
});
jQuery("#paramlistFlex").jqGrid('navGrid','#pagerFlex2',{add:false,edit:false,del:false,search:false});
jQuery("#paramlistFlex").jqGrid('gridResize', {minWidth:350, maxWidth:1920, minHeight:80, maxHeight:1080} );
You use
datatype: "local"in the grid. It’s unclear from the code which you posed how you fill jqGrid. If you useaddRowDatafor filling you should know that it’s the slowest way of filling the local grid.The
urlparameter will be ignored in case ofdatatype: "local"and the reloading of the grid will be done with the local data. For example if you was on the second page or if the data was filtered the filter will be reset and the page number will be 1. If you want to load the data from the server you have to changedatatypeto"json"or to"xml"with respect ofsetGridParambefore trigger “reloadGrid” event.