Persist Data crash when I use sub columns

Hello,


I have a problem when I dynamically add sub-columns to a parent columns. My preference management crashes the application. The getPersistData() function seems to return an undefined ( line 299 )


Is there a problem with adding sub-columns and saving user preferences?


Attachment: persistDataCrash_a91383d8.7z

1 Reply

AR Aishwarya Rameshbabu Syncfusion Team April 10, 2024 12:12 PM UTC

Hi BLANDIN Ewen,


Greetings from Syncfusion support.


Upon reviewing your inquiry, it appears that you are encountering difficulties in persisting data from the Grid after dynamically adding sub columns. We have created a sample based on the files shared, where the persisted data is properly logged in the actionComplete event of the Grid. Within the code, we have implemented a conditional statement inside the map function to ensure that if column.columns is undefined, an empty array is set to its value. Please refer to the code example and sample provided below.


Index.js

                    {newColumns != undefined &&

                        newColumns.map(column => (

                            <ColumnDirective

                                field={column.field}

                                headerText={column.headerText}

                                columns={column.columns != undefined ? column.columns : []}

                            />

                        ))}

 



Sample: https://stackblitz.com/edit/react-ggtb5k-4oi7al?file=index.js


If you are still facing issues, kindly provide the specific scenario in which the problem occurs. If possible, attempt to replicate the issue in the provided sample.


If you need any further assistance or have additional questions, please feel free to let us know.



Regards

Aishwarya R


Loader.
Up arrow icon