Skip to content

Commit bad7720

Browse files
committed
[add] a section on redefining the default comboFilter sorting
1 parent fc89994 commit bad7720

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

docs/grid/configuration.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,19 @@ const grid = new dhx.Grid("grid_container", {
14531453
- **virtual** - (*boolean*) enables dynamic loading of data on scrolling the list of options, *true* by default
14541454
- **template** - (*function*) a function which returns a template with content for the filter options. Takes an option item as a parameter
14551455

1456+
#### Redefining the default sorting for comboFilter
1457+
1458+
By default the elements of the comboFilter are sorted by ID. You can modify the way of sorting elements in this type of the filter inside the handler of the [`beforeOpen`](/combobox/api/combobox_beforeopen_event/) event. For example, you can specify that the options in the comboFilter should be sorted by value in the following way:
1459+
1460+
~~~jsx
1461+
const comboFilter = grid.getHeaderFilter("access").getFilter();
1462+
comboFilter.events.on("beforeOpen", function() {
1463+
comboFilter.data.sort({
1464+
by: "value",
1465+
});
1466+
});
1467+
~~~
1468+
14561469
#### Customizing header/footer filters
14571470

14581471
To add a custom function with your you own logic for the filter of a Grid column, you need to set the `customFilter` attribute when configuring the header/footer content of the [column](grid/api/api_gridcolumn_properties.md).

0 commit comments

Comments
 (0)