Reputation: 59
I am now using jqGrid(version: jqGrid 4.14.1-pre, free jqGrid), with a column which have searchOperators.
The problem occurs when I clear the toolbar. My default operator is "<= (less or equal)". When I change the operator to other and clear the toolbar by x button of the column or the refresh button of navGrid, the searchOperator displays what I chose before, but filters as "<=", the default value. When I click the operator to show the drop-down popup, it highlights the default value, even though the display is different operator like below image.
This is demo that I refered and it does not reset to the default value unlike my case. But I did not find any special difference between it and mine. (I don't think that custom searchOperator might matter.. does it?) What I found was clearToolbar(), but it seems it only reset the textbox values.
I do not mind what kind of operator is left after the clear, but only thing I want is displaying the correct one. Could you please help me?
The following is the grid and toolbar codes.
tbLockedPartiesHistoryArea.jqGrid({
url: '/LockedObjects/GetLockedParties',
datatype: "json",
contentType: "application/json; charset-utf-8",
mtype: 'GET',
emptyrecords: "There is no locked parties currently.",
colModel: [
{label: 'LockedBy', name: 'LockedBy', sorttype: 'text', searchoptions: {clearSearch: true}},
{label: 'LockedDate', name: 'LockedDate', sorttype: 'date', searchoptions: {clearSearch: true},
sortable: true,
resizable: false,
hidden: false,
search: true,
formatter: 'date',
formatoptions: {srcformat: 'm/d/Y h:i:s A', newformat: 'm/d/Y h:i:s A'},
searchrules: {date: true},
searchoptions: {
sopt: ["dle", "deq", "ge"],
dataInit: function (element) {
var self = this;
$(element).datepicker({
dateFormat: 'mm/dd/yy',
changeYear: true,
changeMonth: true,
showButtonPanel: true,
onSelect: function () {
setTimeout(function () {
self.triggerToolbar();
}, 0);
}
});
}
}
}],
rowNum: 20,
rowList: [20, 30, 50],
prmNames: {
page: 'defaultPageNumber',
rows: 'rowsPerPage'
},
customSortOperations: {
deq: {}, //I will just cut this since the code gets too long
dle: {},
},
forceClientSorting: true,
rownumbers: true,
viewrecords: true,
loadonce: true,
multiselect: true,
multiPageSelection: false,
pager: true,
searching: {
searchOperators: true,
defaultSearch: 'cn',
closeOnEscape: true,
searchOnEnter: false,
multipleSearch: true
}
});
tbLockedPartiesHistoryArea.jqGrid('filterToolbar', {
ignoreCase: true,
searchOperators: true,
enableClear: false
});
tbLockedPartiesHistoryArea.jqGrid('navGrid', {
edit: false,
add: false,
del: false,
refresh: true,
refreshtext: "Clear Filter",
refreshtitle: "Clear Filter"
});
};
Upvotes: 1
Views: 352
Reputation: 221997
Thank you for the bug report! The problem exist in case of usage customSortOperations
(described here).
I posted the commit just now. Please get the latest sources of free jqGrid from GitHub. The problem should be solved now.
Upvotes: 1