I have used presistSelection to keep selected row at grid componenet, and then I used getSelectedRecord to handle the draft data in a different function.
When the data is changed and rendering is in progress, the data selected with getSelectedRecord is not updated.
How to get data of selected row other than getSelectedRecords or
Is there a way to force the data of the getSelectedRecord target to be replaced with the latest data?
this is code.
Greetings from Syncfusion support.
Before proceeding to the solution, we would like you to share the following information so that we will be able to proceed further.
A problem of our project is this.
first we select to row and then push 'on' button.
in the console, the status value is off.
this value was got using the getSelectedRecords function.
It call the api that changes the state through the 'on' button and refreshes the screen when it change.
the problem is that the screen has changed, but the state in the console has the old value.
we need not getselectedRecord but another method .
Thanks for sharing the details.
From the shared screenshot it seems that the Grid is updated with the new value. But the value you are showing in the console is not updated as per the button click. Since this reported scenario occurs only in your application, we need the below details from your end to validate it further.
var grid = document.getElementsByClassName('e-grid').ej2_instances
Thank you for answering
There is a correction in your answer.
A new row is not clicked after the state has changed
Even if the state changes with persistSelection, the row maintains the selected state.
There is no way to select a row and select a row again with persistSelection.
When the state is changed through an action, it is refreshed and the data on the screen changes, but only the data set by getSelectedRecord does not change.
I'm sorry, but I've already told you all the cases, so I can't provide more screens and codes.
I wonder if there is a way to get the selected row value other than getSelectedRecord.
From your query, we understood that you have stored the selected data using the “getSelectedRecords” method and after the page is refreshed, you are again showing the already stored data only which is the cause of the reported scenario. The changes in the Grid will not affect the already stored value. So You need to call the “getSelectedRecords” method to get the selected record with the new changes which is the only way to achieve your requirement.