Author Topic: Multiple header filter are not cascaded with each other  (Read 2075 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Multiple header filter are not cascaded with each other
« 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?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Multiple header filter are not cascaded with each other
« Reply #1 on: September 06, 2017, 11:01:02 pm »
Please use oper: 'add' instead of oper: 'replace' in filter method.

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Multiple header filter are not cascaded with each other
« Reply #2 on: September 06, 2017, 11:20:16 pm »
Thanks !! ;D :D