You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: knowledge-base/grid-cascade-dropdowns-for-fields.md
+26-4Lines changed: 26 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,18 +25,22 @@ res_type: kb
25
25
I want to have the options for one of the fields in the grid to depend on the choice of another. In other words, to cascade one dropdown from the other in the grid columns.
26
26
27
27
## Solution
28
-
There are two approaches you can take:
28
+
There are three approaches you can take:
29
29
30
30
* For full freedom, implement a custom edit form (here are examples for <ahref="https://demos.telerik.com/blazor-ui/grid/editing-custom-form"target="_blank">inline</a>, and <ahref="https://github.com/telerik/blazor-ui/tree/master/grid/custom-popup-form"target="_blank">popup</a>)
31
31
32
-
* Implement the general approach for [cascading dropdowns]({%slug dropdown-kb-cascading%}) in the [editor templates]() of those fields. a key thing is to create new data collections, and to use the OnChange event.
32
+
* Implement the general approach for [cascading dropdowns]({%slug dropdown-kb-cascading%}) in the [editor templates]({%slug grid-templates-editor%}) of those fields. a key thing is to create new data collections, and to use the OnChange event. You may also want to handle the `OnEdit` event of the grid to provide initial data for the second column.
33
+
34
+
* Use load on demand for the dropdowns themselves (their `OnRead` event) so that when they initialize, they will fire the event, and you can load the data there. The component fires the event when needed and you can use the currently edited item you store in the view-model to provide more information to your service.
35
+
33
36
34
37
>caption Example of cascading dropdowns in grid editor templates in popup edit mode (works for inline mode too)
35
38
36
39
````CSHTML
37
40
@* Field 1 determines what you see in the cascaded field. The code comments offer some more details *@
0 commit comments