Hi team,
I have added the multiple filter in header but each filter working separately it should work based on the previous filtered record .
I am using below code for multiple filters function.
function filterhandler(evt, ui) {
var $grid = $("#grid_json").pqGrid();
var $toolbar = $grid.find('.pq-toolbar-search'),
value = $toolbar.find(".filterColumn").val(),
dataIndx = $grid.pqGrid("getColModel")[1].dataIndx,
filterObject = [{ dataIndx: dataIndx, condition: 'equal', value: value }];
$grid.pqGrid("filter", {
oper: 'replace',
rules: filterObject
});
}
function filterPhasehandler(evt, ui) {
var $grid = $("#grid_json").pqGrid();
var $toolbar = $grid.find('.pq-toolbar-search'),
value = $toolbar.find(".filterPhase").val(),
dataIndx = $grid.pqGrid("getColModel")[2].dataIndx,
filterObject = [{ dataIndx: dataIndx, condition: 'equal', value: value }];
$grid.pqGrid("filter", {
oper: 'replace',
rules: filterObject
});
}
function filterDivisionhandler(evt, ui) {
var $grid = $("#grid_json").pqGrid();
var $toolbar = $grid.find('.pq-toolbar-search'),
value = $toolbar.find(".filterDivision").val(),
dataIndx = $grid.pqGrid("getColModel")[3].dataIndx,
filterObject = [{ dataIndx: dataIndx, condition: 'equal', value: value }];
$grid.pqGrid("filter", {
oper: 'replace',
rules: filterObject
});
}
function filterCostCode(evt, ui) {
var $grid = $("#grid_json").pqGrid();
var $toolbar = $grid.find('.pq-toolbar-search'),
value = $toolbar.find(".filtercost").val(),
dataIndx = $grid.pqGrid("getColModel")[4].dataIndx,
filterObject = [{ dataIndx: dataIndx, condition: 'equal', value: value }];
$grid.pqGrid("filter", {
oper: 'replace',
rules: filterObject
});
}
function filterBudgetYear(evt, ui) {
var $grid = $("#grid_json").pqGrid();
var $toolbar = $grid.find('.pq-toolbar-search'),
value = $toolbar.find(".filteryear").val(),
dataIndx = $grid.pqGrid("getColModel")[7].dataIndx,
filterObject = [{ dataIndx: dataIndx, condition: 'equal', value: value }];
$grid.pqGrid("filter", {
oper: 'replace',
rules: filterObject
});
}
function filterSnapshot(evt, ui) {
var $grid = $("#grid_json").pqGrid();
var $toolbar = $grid.find('.pq-toolbar-search'),
value = $toolbar.find(".filterSnapshot").val(),
dataIndx = $grid.pqGrid("getColModel")[5].dataIndx,
filterObject = [{ dataIndx: dataIndx, condition: 'equal', value: value }];
$grid.pqGrid("filter", {
oper: 'replace',
rules: filterObject
});
}
Please check and let me know where I am doing wrong?