Skip to content

Commit 97c2c7f

Browse files
authored
chore(grid): update docs for filters in state (#796)
1 parent 618c806 commit 97c2c7f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

_contentTemplates/grid/state.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
#filter-menu-from-code
113113
@* This snippet shows how to set filtering state to the grid from your code
114114
Applies to the FilterMenu mode *@
115-
115+
116116
@using Telerik.DataSource;
117117

118118
<TelerikButton ThemeColor="primary" OnClick="@SetGridFilter">set filtering from code</TelerikButton>
@@ -176,9 +176,11 @@
176176
}
177177
#end
178178

179-
180179
#filter-menu-default-filters
181-
>note When the Grid `FilterMode` is `FilterMenu`, the component will create default `FilterDecriptor`s in its state for **all columns**. This allows filter templates to work seamlessly and with little code. If you want to alter filters for a column, you must either modify the existing descriptor, or replace it. Simply adding an additional `FilterDescriptor` will not show up in the UI, because the Grid uses the first descriptor for the given field for the filtering UI. Another implication is that the Grid state always contains filter descriptors, no matter if the user has filtered or not. Inactive filter descriptors are distinguished by their `null` `Value`.
180+
181+
>note Until version `3.1.0`, there was a bug that made the component create default `FilterDecriptor`s in its state for **all columns** when `FilterMode` is `FilterMenu`, including when no filtering occurs at all. This side-effect allowed filter templates to work seamlessly and with little code. After version `3.1.0`, ths bug was fixed and empty `FilterDecriptor`s are not added to the state of the component if no filtering occurs (the way filter templates work is unchanged).
182+
183+
>note If you want to alter filters for a column, you must either modify the existing descriptor, or replace it. Simply adding an additional `FilterDescriptor` will not show up in the UI, because the Grid uses the first descriptor for the given field for the filtering UI. Another implication is that the Grid state always contains filter descriptors, no matter if the user has filtered or not. Inactive filter descriptors are distinguished by their `null` `Value`.
182184
183185
>caption Handling filter changes - unexpected addition that does not update the UI, replacement of one filter, replacecment of all filters
184186
@@ -268,7 +270,7 @@ This flexibility lets you choose what behavior you want from the grid.
268270
// see the extension methods related to GetFiltersForMember in the adjacent code tab
269271
// create a new collection so we can iterate over it without it getting lost with the removal from the parent collection
270272
List<IFilterDescriptor> teamFilters = new List<IFilterDescriptor>(state.FilterDescriptors.GetFiltersForMember("Team"));
271-
273+
272274
// remove the existing filters for the Team field from the current collection
273275
for (int i = 0; i < teamFilters.Count(); i++)
274276
{
@@ -509,10 +511,10 @@ public static class FilterExtensions
509511
GridState<MainModel> desiredState = new GridState<MainModel>()
510512
{
511513
//expand the first two rows
512-
ExpandedItems = new List<MainModel>
513-
{
514-
salesTeamMembers[0],
515-
salesTeamMembers[1]
514+
ExpandedItems = new List<MainModel>
515+
{
516+
salesTeamMembers[0],
517+
salesTeamMembers[1]
516518
}
517519
};
518520

0 commit comments

Comments
 (0)