Record selection is lost when clicking on expand/collapse buttons on other records.

Record selection is lost when clicking on expand/collapse buttons on other records. I Have used Group By on a specific column and selected a  record and then when expanding next record to expand . Existing selection is lost.

I have attached a screenshot of it:

Image_4659_1709184053427


Image_2183_1709184119238


3 Replies

VK Vasanthakumar K Syncfusion Team March 4, 2024 05:53 AM UTC

Hi Viji Palanisamy,


Greetings from Syncfusion support.


We have validated your query and understand that you need to persist normal row selection when clicking expand and collapse of other grouped caption rows. By default, the grid doesn’t persist selection, but if we enable persistence by setting selectionSettings.persistSelection as true with the primary key defined in one unique data column, we can persist row selection. We have already discussed this topic in our Angular documentation below, and we will update the React documentation soon.


Based on your requirements, we have prepared a sample to achieve this. In that sample, we define one checkbox column with visible false, set one column as the primary key, and also set selectionSettings.persistSelection as true to meet your requirements and it works like checkbox selection functionality (maintain multiple row selection). You can refer to the code example, sample, and documentation below for more details.


[code example]

<GridComponent dataSource={orderDataSource}

                allowPaging={true}

                ref={grid => gridInstance = grid}

                toolbar={toolbarOptions}

                pageSettings={{ pageCount: 5 }}

                editSettings={editSettings}

                selectionSettings={{persistSelection: true}}

                allowGrouping={true}

                groupSettings={groupOptions}

                allowSorting={true} height="320"

                dataBound={dataBound.bind(this)}

                created={created}>

                    <ColumnsDirective>

                        <ColumnDirective headerText='id' type="CheckBox" visible={false} width="70"/>

                        <ColumnDirective field='OrderID' headerText='Order ID' width='140' textAlign='Right' validationRules={orderidRules} isPrimaryKey="true"></ColumnDirective>

                        . . . . . . . .

                        <ColumnsDirective>

</GridComponent>


Sample: 186986-expand-colpse-selection-persist - StackBlitz


Angular documentation: Row selection in Angular Grid component | Syncfusion


Regards,

Vasanthakumar K



VP Viji Palanisamy March 6, 2024 12:22 AM UTC

I fixed the issue and it work as expected. Thanks



VK Vasanthakumar K Syncfusion Team March 11, 2024 06:04 AM UTC

Hi Viji Palanisamy,


We are happy to hear that our provided solution was helpful for your problem.


Kindly get back to us if you have any further queries. As always, we will be happy to assist you.


Regards,

Vasanthakumar K


Loader.
Up arrow icon