Thanks for your reply. The code and responses below use 'Count', 'Into', 'Out' instead of the original mentioned 'Add' and 'Subtract' but naturally my problem is still the same.
This is the response from my server - as taken from the browser development tool (Chrome function F12)...
<div class="pq-td-div">
<select name="transtype" class="pq-grid-hd-search-field ui-corner-all" style="">
<option value="">--All--</option>
<option>Count</option>
<option>Out</option>
</select>
</div>
and this is my code...
column definition in var colM...
{ title: "Action", width: 100, dataIndx: "transtype", align:"center", editable: false,
filter: { type: "select",
condition: 'equal',
valueIndx: "transtype",
labelIndx: "transtype",
prepend: { '': '--All--' },
listeners: ['change']
}
},
my table definition...
var table = { width: 1200, height: 'flex',
dataModel: dataModel,
sortModel: sortModel,
colModel: colM,
pageModel: pageModel,
scrollModel: {autoFit:true},
title: "Transactions",
flex: {on:true, all:false},
// flexHeight: true,
// flexWidth: true,
resizable: true,
numberCell: { show: false, resizable: true, title: "#" },
filterModel: { on: true, mode: "AND", header: true, type: 'remote' },
freezeCols: 3,
toolbar: {
cls: 'pq-toolbar-export',
items: [{
type: 'button',
label: "Export to Excel",
icon: 'ui-icon-document',
listeners: [{
"click": function (evt) {
$("#grid_php").pqGrid("exportExcel", { url: "exporttransactions.php", sheetName: "Transactions" });
}
}]
}]
}
};
and my table/filter initialising...
var grid = pq.grid( "#grid_php", table);
grid.one("load", function (evt, ui) {
var column = grid.getColumn({ dataIndx: "transstatus" });
var filter = column.filter;
filter.cache = null;
filter.options = grid.getData({ dataIndx: ["transstatus"] });
var column = grid.getColumn({ dataIndx: "transtype" });
var filter = column.filter;
filter.cache = null;
filter.options = grid.getData({ dataIndx: ["transtype"] });
//and apply initial filtering.
grid.filter({
oper: 'add',
data: [
{ dataIndx: 'transstatus', value: 'Active' },
{ dataIndx: 'transtype', value: 'Count' }
]
});
});
Ideally I would like the transtype filter to work as a multiple select with 'range' rather than individual selection with 'equal', but I was having even less success making that work because the prepend selection resulted in zero rows rather than all rows retrieved.
I don't know if the above code is enough to go on, but I'll keep my fingers crossed that you can see something wrong with it.
Many thanks.