Hi all
I have a Jqgrid with a drop-down filter which is populated by the data from the grid using the "beforeProcessing" method.
How to adding multiple drop-down filters to a Jqgrid
My code is:
jQuery("#jQGridDemo").jqGrid({
url: 'http://localhost:58404/JQGridHandler.ashx',
datatype: "json",
colNames: ['Property ID', 'Property Ref', 'Short Address', 'Property Type', 'Tenure Type', 'Status'],
colModel: [
{ name: 'PropertyID', index: 'PropertyID', width: 70, align: "left", stype: 'text', sortable: true},
{ name: 'PropertyRef', index: 'PropertyRef', width: 75, align: "left", stype: 'text', sortable: true},
{ name: 'ShortAddress', index: 'ShortAddress', width: 200, align: "center", sortable: true},
{name: 'PropertyType',width: 80},
{ name: 'TenureType', index: 'TenureType', width: 80, align: "center", sortable: true },
{ name: 'Status', index: 'Status', width: 75, align: "center", sortable: true },
],
height: 'auto',
width: 'auto',
beforeProcessing: function (data) {
var propertyMap = {}, propertyValues = ":All", rows = data, i, symbol;
for (i = 0; i < rows.length; i++) {
symbol = rows[i].PropertyType;
if (!propertyMap.hasOwnProperty(symbol)) {
propertyMap[symbol] = 1;
propertyValues += ";" + symbol + ":" + symbol;
}
}
$(this).jqGrid("setColProp", 'PropertyType', {
stype: "select",
searchoptions: {
value: propertyValues
}
}).jqGrid('destroyFilterToolbar')
.jqGrid('filterToolbar', {
stringResult: true,
searchOnEnter: false,
defaultSearch: "cn"
});
},