Author Topic: Updating filters  (Read 2097 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Updating filters
« on: June 29, 2016, 02:16:56 am »
Hi

Is it possible to only show possible filters (that will give match) for column 2 depending on what chosen as filter in column 1?
Im using pqSelect and currently it show all possible values even though it will result in zero matches.

Thanks.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Updating filters
« Reply #1 on: June 29, 2016, 08:39:36 pm »
That is a good use case, but there is no perfect solution for it currently.

One workaround solution is to use getData() method to update options in 2nd dropdown (ship region dropdown) in filter event.

The below code is in the context of the demo: http://paramquery.com/pro/demos/filter_header_local
Code: [Select]
filter: function(){
    var column = this.getColumn({ dataIndx: "ShipRegion" });
            var filter = column.filter;
if(!filter.value || !filter.value.length){
filter.cache = null;
filter.options = this.getData({
dataIndx: ["ShipCountry", "ShipRegion"],
data: this.option('dataModel.data')
});
}
this.refreshHeader();
},