Reputation: 2141
I have two jqxgrids that are both sourced from the same place and use the same dataAdapter to get the data. One grid has columns that are filterable. I can't figure out how to force the second grid to re-filter automatically when user enters some filter text in the first. Has anyone done that or it is even possible without having to create custom filters?
Upvotes: 2
Views: 1479
Reputation: 1
You can bind a method to the first grid's filter
event. As specified in the API:
$("#jqxGrid").on("filter", function (event) {
var filterinfo = $("#jqxgrid").jqxGrid('getfilterinformation');
// then iterate through the filters applied to the 1st grid, and
// write the appropriate codes to apply the same filters to the 2nd grid
});
HTH :)
Upvotes: 0
Reputation: 2297
Using the 'getfilterinformation', you can get the jqxGrid's filters, conditions and values. getfilterinformation returns an array of filters. Each item in the array has the following fields:
filter - that's the column's filter. You can think about the filter as a group of filters, because a column may have more than 1 applied filters. By calling filter.getfilters(), you can get all filters applied to a column. Each filter in the filter group, has {value, condition, operator and type}, where value is the filter's value, condition is ex: "Contains", operator could be "and" or "or" and the type represents the filter's type (stringfilter, datefilter, etc.).
filter column's datafield.
Then, you can apply the filter to a Grid instance as shown in this sample: customfiltering.htm
Upvotes: 1