Skip to content

Table selection is reset after ReloadData() #3167

Answered by JesperOlsen
JesperOlsen asked this question in Q&A
Discussion options

You must be logged in to vote

I didn't bother reading through the source code, but it appears that when you set up your selection-column you use a unique string as a key like so <Selection Key="@context.Id"/>, but internally in the component it will use the object-reference to see if the object is still in both SelectedKeys and in the Data. This means that when I refresh data in the background the table will remove the selection because now there are new objects (though with the same keys).
I got this to work by in the HandleTableChange event after loading my data then setting the selectedRows with the new objects

`
async Task HandleTableChange(AntDesign.TableModels.QueryModel queryModel)
{
var _data = read_my_data_he…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JesperOlsen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant