avair
May 15, 2023, 8:12 AM
In the below .aspx markup based on group field the tree view is getting bound in the frontend but to that tree view for the child values I need to bind select all and unselect all based on the condition like if all the child values in the Group are selected the it should show Unselect all, if child values are not selected it should show Select All. How can I achieve this?
<ext:Store ID="stStudents" runat="server" GroupField="Subjects">
<Model>
<ext:Model ID="Model8" runat="server">
<Fields>
<ext:ModelField Name="ID" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="Name" Direction="ASC" />
</Sorters>
</ext:Store>
<ext:Container runat="server">
<LayoutConfig>
<ext:HBoxLayoutConfig Align="Middle"/>
</LayoutConfig>
<Items>
<ext:DisplayField runat="server" FieldLabel="<%$ Resources: Src,Rpeople%>" ID="DisplayField1"></ext:DisplayField>
<ext:Panel runat="server" Flex="25" Title="<%$ Resources: Src,people%>">
<Items>
<ext:MultiSelect runat="server" ID="MultiSelect1" MultiSelect="true" DisplayField="Name" ValueField="ID" ShowCheckbox="false" SingleSelect="true" StoreID="stpeople">
</ext:MultiSelect>
<ext:GridPanel ID="GridPanel1" runat="server" Border="true" TitleAlign="Center" AutoHeight="true" Hidden="true" StoreID="stpeople">
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="<%$ Resources: Src,Name%>" DataIndex="Name" Flex="1">
</ext:Column>
<ext:CommandColumn runat="server" Hidden="true">
<GroupCommands>
<ext:CommandSpacer/>
<ext:GridCommand Icon="Tick" CommandName="Select All">
<ToolTip Title="Select" Text="" />
</ext:GridCommand>
<ext:CommandSpacer/>
<ext:GridCommand Icon="Cross" CommandName="DeSelect All">
<ToolTip Title="Deselect" Text="" />
</ext:GridCommand>
</GroupCommands>
<Listeners>
<GroupCommand Fn="onGroupCommand" />
</Listeners>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel runat="server" ID="CheckboxSelectionModel1" Mode="Simple" ShowHeaderCheckbox="true">
</ext:CheckboxSelectionModel>
</SelectionModel>
<View>
<ext:GridView ID="GridView1" runat="server" TrackOver="false" ></ext:GridView>
</View>
<Features>
<ext:GroupingSummary runat="server" EnableNoGroups="true" HideGroupedHeader="true" EnableGroupingMenu="false" StartCollapsed="true">
</ext:GroupingSummary>
</Features>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:Container>
<ext:Store ID="stStudents" runat="server" GroupField="Subjects">
<Model>
<ext:Model ID="Model8" runat="server">
<Fields>
<ext:ModelField Name="ID" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="Name" Direction="ASC" />
</Sorters>
</ext:Store>
<ext:Container runat="server">
<LayoutConfig>
<ext:HBoxLayoutConfig Align="Middle"/>
</LayoutConfig>
<Items>
<ext:DisplayField runat="server" FieldLabel="<%$ Resources: Src,Rpeople%>" ID="DisplayField1"></ext:DisplayField>
<ext:Panel runat="server" Flex="25" Title="<%$ Resources: Src,people%>">
<Items>
<ext:MultiSelect runat="server" ID="MultiSelect1" MultiSelect="true" DisplayField="Name" ValueField="ID" ShowCheckbox="false" SingleSelect="true" StoreID="stpeople">
</ext:MultiSelect>
<ext:GridPanel ID="GridPanel1" runat="server" Border="true" TitleAlign="Center" AutoHeight="true" Hidden="true" StoreID="stpeople">
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="<%$ Resources: Src,Name%>" DataIndex="Name" Flex="1">
</ext:Column>
<ext:CommandColumn runat="server" Hidden="true">
<GroupCommands>
<ext:CommandSpacer/>
<ext:GridCommand Icon="Tick" CommandName="Select All">
<ToolTip Title="Select" Text="" />
</ext:GridCommand>
<ext:CommandSpacer/>
<ext:GridCommand Icon="Cross" CommandName="DeSelect All">
<ToolTip Title="Deselect" Text="" />
</ext:GridCommand>
</GroupCommands>
<Listeners>
<GroupCommand Fn="onGroupCommand" />
</Listeners>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel runat="server" ID="CheckboxSelectionModel1" Mode="Simple" ShowHeaderCheckbox="true">
</ext:CheckboxSelectionModel>
</SelectionModel>
<View>
<ext:GridView ID="GridView1" runat="server" TrackOver="false" ></ext:GridView>
</View>
<Features>
<ext:GroupingSummary runat="server" EnableNoGroups="true" HideGroupedHeader="true" EnableGroupingMenu="false" StartCollapsed="true">
</ext:GroupingSummary>
</Features>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:Container>