ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: EPM Solutions on September 06, 2017, 07:30:33 pm

Title: Multiple header filter are not cascaded with each other
Post by: EPM Solutions on September 06, 2017, 07:30:33 pm
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?
Title: Re: Multiple header filter are not cascaded with each other
Post by: paramvir on September 06, 2017, 11:01:02 pm
Please use oper: 'add' instead of oper: 'replace' in filter method.
Title: Re: Multiple header filter are not cascaded with each other
Post by: EPM Solutions on September 06, 2017, 11:20:16 pm
Thanks !! ;D :D