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-conditional-expand-button.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,30 +22,36 @@ res_type: kb
22
22
23
23
24
24
## Description
25
-
How would you remove the icon to expand a detail grid only for certain rows? Some rows will not have detail data and should not be expandable.
26
25
27
-
I would like the expand to only be visible when it has further data to expand.
26
+
How would you remove the icon to expand a detail Grid only for certain rows? Some rows will not have detail data and should not be expandable.
27
+
28
+
I would like the expand to only be visible when it has further data to expand.
28
29
29
30
## Solution
30
31
31
-
Use the [`OnRowRender` event]({%slug grid-events%}#onrowrender) to evaluate the current row item (for example, whether it has child items in a collection or some other flag your application has).
32
+
Use the [`OnRowRender` event]({%slug grid-events%}#onrowrender) to evaluate the current row item (for example, whether it has child items in a collection or some other flag your application has).
32
33
33
-
Then, if you want to hide the expand icon, set a CSS class to the row that will hide the button in the expand cell.
34
+
Then, if you want to hide the expand icon, set a CSS class to the row that will hide the icon in the expand cell. It is also important to disable the pointer events of the cells with no expand icons, so the user cannot click them to open the empty child Grid even though the plus icon is hidden.
34
35
35
36
>caption Hide the expand button conditionally per row
36
37
37
38
````CSHTML
38
39
@* Use CSS and the RowRender event to hide the detail template expand button conditionally *@
39
-
40
40
<style>
41
41
/*
42
42
A CSS rule that matches the OnRowRender handler to
43
-
conditionally hide hierarchy expand buttons.
43
+
conditionally hide hierarchy expand buttons and
44
+
stops the pointer events of the cells with no
45
+
expand buttons.
44
46
You may want to add this to your site-wide stylesheet.
0 commit comments