Author Topic: Filter Remote Grid  (Read 2235 times)

shldbapp

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 5
    • View Profile
Filter Remote Grid
« on: April 13, 2015, 08:06:12 pm »
I am working with a local copy of
http://paramquery.com/pro/demos/filter_header_local

Where I added the following code for a toolbar with a checkbox:

Code: [Select]
  toolbar: {
                    cls: "pq-toolbar-search",
                    items: [
                        { type: "<span style='margin:2px;'>Grid Title</span>" },
                        { type: 'separator' },
                        {
                            type: 'checkbox', style: 'margin-right:5px;', attr: 'id=seinactive', listener:
                              {
                                  "change": function (evt, ui) {
                                     
                                      // Function
                                      filter("Ship Country", "Brazil");
                                     
                                  }
                              }
                        },
 { type: "<label for='seinactive'>Inactive</label>" },

And the function to filter:

Code: [Select]
        function filter(dataIndx, value) {
            $grid = $("#grid_custom_editing").closest('.pq-grid');

            $grid.pqGrid("filter", {
                data: [{ dataIndx: dataIndx, value: value, type: "local" }]
            });
            $grid.pqGrid("refreshDataAndView");
        }

Unfortunately it does not work. The filter has no effect on the grid. How to make it work?




paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter Remote Grid
« Reply #1 on: April 13, 2015, 08:29:42 pm »
Check whether you have defined filterModel correctly.

filterModel: { on: true, header: true, type: 'local' },

Check whether your filter function is getting called by putting a breakpoint or alert box.

You syntax for filter method is incorrect, arguments are missing.

Please refer the API http://paramquery.com/pro/api#method-filter

Please post a jsfiddle if still facing problems.