binding and filters

Dear Friends,

I bind lists as master and slave, but when I apply filter in slave, the filter dose not strict the binding rule.

pls see=> http://disq.us/p/1gun4hc

How can I filter and set it strict with binding rule?

Thank you
(sorry for my English)

Tagged:

Comments

  • edited March 2017

    Hello,

    In essence, the slave collection is filtered according to the binding rule. So, when it is filtered by header filters, the binding filter is ignored.

    You can change the .filterByAll() method of the slave Datatable to preserve your binding rule.

    The filterByAll() method is called automatically, when the Datatable filters itself according to header filters. So, you need to apply the basic logic in it and filter the data again according to the binding rule: this.filter(rule, text, preserve).

    var baseFilter = gridb.filterByAll;
    
    gridb.filterByAll=function(){
      baseFilter.call(this);
      //repeat your binding rule
      this.filter(function(obj){
        //getCursor returns id of selected record in master
        return obj.index == grida.getCursor();
      }, null, true); //here the 3rd parameter preserves the existing filtering
    };
    
    gridb.bind(grida, function(slave, master){ 
      return master.id == slave.index;
    }); 
    

    Check the following snippet, please: http://webix.com/snippet/fe13d3f4

  • Great!!
    Thanks

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!