Author Topic: Filter does not work  (Read 2685 times)

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Filter does not work
« on: May 17, 2016, 02:24:52 am »
Hi,

I am trying to implement the Remote filter option in the grid, I am not sure what am I missing.

Here are the step I have done:
1.  colModel: {   title: "Country", width: "160", align: "left", dataIndx: "COUNTRY_NAME",
   filter: { type: 'textbox', condition: 'begin', listeners: ['keyup'] }
     }

2.  filterModel: { on: false, mode: "AND", header: true  }

3. dataModel: {
            location: "remote",
            sorting: "local",
            dataType: "JSON",
            sortIndx: "COUNTRY_NAME",
            recIndx: "COUNTRY_NAME",
            method: "GET",
            getData: function (dataJSON) {
               var data = dataJSON.data;
               //expand the first row.
               data[0]['pq_detail'] = { 'show': true };
               return { data: data };
            }

Whenever I type any thing on the Filter option, it does not filter, but show the entire dataset.

Please advice, what am I Missing ?

thx
Prabhu

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Filter does not work
« Reply #1 on: May 17, 2016, 11:44:27 am »
filterModel.on should be true.

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Filter does not work
« Reply #2 on: May 17, 2016, 06:28:50 pm »
I changed the filterModel on as true, still no luck

Is it required to specify the filter.option ?

When I put a debbuger on the getData: function, I see that it is getting all the dataJson has recordFiltered: null.

data:Array[1432]
draw:null
error:null
fieldErrors:Array[0]
id:null
meta:Object
options:Object
recordsFiltered:null
recordsTotal:null
row:null
__proto__:Object
« Last Edit: May 17, 2016, 06:31:40 pm by iamgsprabhu »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Filter does not work
« Reply #3 on: May 17, 2016, 06:45:05 pm »
When dataModel.location is 'remote' grid expects remote filtering.

To specify local filtering, add type: 'local' to filterModel

filterModel: { on: true, mode: "AND", header: true, type: 'local'  }

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Filter does not work
« Reply #4 on: May 17, 2016, 10:50:15 pm »
put logic on the remote side and it works like gem.

thanks for the help.