tonytomov/jqGrid — Issue #193: filterToolbar issues on table loading
Author: iCoderXXI
Created: 2011-10-31 16:30:02+00:00
State: open

I have one of the columns with the folowing attributes:

{ name:'deleted',index:'n.deleted', width: 60, op:'cn',
formatter:'select',
search: true,
stype: 'select',
searchoptions: {
defaultValue: "0",
value:	":All;"+
"0:No;"+
"1:Yes"
},
editoptions: {
value:	":All;"+
"0:No;"+
"1:Yes"
}
},

I also user filterToolbar for searching

jQuery("#dataGrid_news").jqGrid('filterToolbar', {
stringResult: true, searchOnEnter : false, defaultSearch:'cn'}
);

I have a field in the table, named "deleted", which could have value of either 0 or 1, I want the grid hide those with "1" by default, but let user see them by selecting 'Yes' option in select.

When I use select for filtration - it works as needed. But there are two issues:
1) On table load it does not filter values for this column, even though correct default value is set in select
2) On table refresh it also does not use filter. And even more, if I set stype: 'text' - the value I entered is not being used and grid gets data from server as there wasn't filter at all.

In the same time .trigger("reloadGrid") works good and filter works with it.

By now I have to run following code to fix the problem:

$(document).ready(function() {
$('body').queue(function() {
//$('[name="n.deleted"]').change();
$('#dataGrid_news').trigger("reloadGrid");
console.log('Yo!');
});
});

And I also disabled "refresh" button like that:
jQuery("#dataGrid_news").jqGrid('navGrid', '#dataGridPager_news',
{ refresh: false, edit:false, add:false, del:false, search:false },
... );