WTableView or WStandardItemModel reload
What is the best way to reload data in WTableView?
I have got a WTableView with a WStandardItemModel as model.
In the model, I create the columns and load the data. The WTableView can be sorted and the columns width can be resized by the user in the browser.
I first have tried to use WStandardItemModel.clear() to clear the data. This works but it clears the column sorting and column sizing also.
Now I use removeRows() like this:
if ( WStandardItemModel.getRowCount() > 0 ) // if 0 rows it throws an exception
WStandardItemModel.removeRows( 0, WStandardItemModel.getRowCount() );
This clears the data correct, but after adding the new data it is not sorted any more.
How should I reload the data?
Nobody knows what's wrong and what's right (to compare with c wt which is great)
I reload like this - reset model at first and re-insert model. Everything is ok