See #2488.
It updates the Grid version.
There is an extracted test for changing data provider.
It's ignored for now.
For some reason the content in the rows is not visible . Though the number of cells is correct.
items on the client side gives the correct items.
The items becomes visible if DnD is done over the Grid.
May be it's a client side issue in v4.
The localized issue is:
$0.size=4;
$0._cache[0]=[]
$0._updateItems(0, []);
$0._cache[0]=[{"key":"201","col0":"200","col1":"3"},{"key":"202","col0":"201","col1":"3"},{"key":"203","col0":"202","col1":"3"},{"key":"204","col0":"203","col1":"3"}];
$0._updateItems([{"key":"201","col0":"200","col1":"3"},{"key":"202","col0":"201","col1":"3"},{"key":"203","col0":"202","col1":"3"},{"key":"204","col0":"203","col1":"3"}]);
The result : the content is not rendered. The number of rows is 4. But nothing is visible in 4 rows of the Grid.
The rows become visible if DnD is done over the Grid.
Interesting that this code works as it should :
$0.size=1;
$0._cache[0]=[]
$0._updateItems(0, []);
$0._cache[0]=[{"key":"201","col0":"200","col1":"3"}]
$0._updateItems(0, [{"key":"201","col0":"200","col1":"3"}]);
Elements team recommendation: do not call underscored APIs please.
I don't know whether this is possible or not but it looks like the current client side Grid connector should be rewritten to avoid underscored methods and hacky ways.
I think it's a very big task.
From the client-side's point of view, what's the difference between doing a full refresh for an existing DataProvider and completely switching to another DataProvider instance?
There is no really a difference.
It changes the size of the Grid and then it calls ._updateItems with an empty array and then with data in the array.
Clearing works ok and it stays cleared after setting data.
So theoretically it may happen with the same data provider as well.
Well, from the client side's point of view the data provider is not changed at all.
Just see above the consequence of calls on the client side.
So the ticket description then should be that we don't support any changes to the data?
I can add that DataProvider.refreshAll won't update grid contents as it should.
Do we support at the moment any changes in the Grid at all?
I don't remember anything related to that implemented.
The only "change" that we support is changing the data provider entirely. This doesn't work.
DataProvider.refreshAll doesn't work because there is nothing in Grid that supports any update. This is just not implemented.
I would say this is a separate issue.
See #2524 for refresh.