File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed
src/BootstrapBlazor/Components/ListView Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 1616 {
1717 if (GroupName == null )
1818 {
19- foreach (var item in Rows )
20- {
21- < div class = " listview-item" @onclick = " @(e => OnClick(item))" >
22- @BodyTemplate (item )
23- < / div >
24- }
19+ @RenderGroup (Rows )
2520 }
2621 else if (Collapsible )
2722 {
3833 < div @key = " @key.GroupName" class = " accordion-item" >
3934 < div class = " accordion-header" > @key .GroupName < / div >
4035 < div class = " accordion-body" >
41- @foreach (var item in key .Items )
42- {
43- < div class = " listview-item" @onclick = " @(e => OnClick(item))" >
44- @BodyTemplate (item )
45- < / div >
46- }
36+ @RenderGroup (key .Items )
4737 < / div >
4838 < / div >
4939 }
7767@code {
7868 RenderFragment RenderItem ((object ? GroupName , IOrderedEnumerable < TItem > Items ) key , int index ) =>
7969 @<CollapseItem Text =" @GetGroupName(key.GroupName)" IsCollapsed =" IsCollapsed(index, key.GroupName)" >
80- @foreach ( var item in key .Items )
70+ @RenderGroup(key.Items)
71+ </CollapseItem >;
72+
73+ RenderFragment <IEnumerable <TItem >> RenderGroup => items =>
74+ @< div class = " listview-item-group" >
75+ @foreach (var item in items )
8176 {
82- <div class =" listview-item" @onclick =" @(e => OnClick(item))" >
77+ < div @key = " item " class = " listview-item" @onclick = " @(e => OnClick(item))" >
8378 @if (BodyTemplate != null )
8479 {
8580 @BodyTemplate (item )
8681 }
8782 < / div >
8883 }
89- </CollapseItem >;
84+ < / div > ;
9085}
You can’t perform that action at this time.
0 commit comments