is it possible to bind a selectFilter to a segmented component.
so if i filter in the datatable it would change the selected segmented button or if i change the selected sebmented button it will change the filter on the data table ?
Hi MPaul,
Filter and segmented button can be bound with the help of their events, namely the:
- onChange for segmented button where you change the value of a datatable filter and if needed, refilter the grid:
"onChange":function(newv, oldv){
$$("grid").getFilter("title").value = newv;
$$("grid").filterByAll();
}
- onAfterFilter for datatable where you change the value of a segmented button:
$$("segmented").setValue(this.getFilter("title").value);
http://webix.com/snippet/6d27f225
Additionally you can temporarily block events of either of the components to stay on the safe side and avoid recursion ( as shown in commented lines in the snippet above).
Still, if the value of a segmented button doesn’t change, the onChange event is not called. The same for the grid - if filter value remains unchanged, the onAfterFilter event doesn’t fire.
Thanks Helga,
That’s exactly what i was looking for.