Issue
When changing the number of columns and rows of natTable After clearing the column list of DataProvider, create a new column item and change the column item list of columnPropertyAccessor. Then, put the new data model into the filter list and refresh it.
When the 7-column nattable is sorted (ascending or descending) and clicked, it is changed to a different data model (4 columns) as above, but if it is sorted, "CurrentModificationException" and "IndezxOutOfBoundException" occur. If you exchange data models without sorting, there is no problem. I don't know which part is causing it.
Is my way of replacing the filter list wrong when changing the data model? If anyone has encountered a similar error and has solved it, please help.
Solution
Well you don't show how you are doing things, so I can't tell any details. But to answer your question, yes I think you are doing things wrong.
In short, if you have a state applied according to a column like sorting or filtering and you change the underlying data structure, things will break as the states does match the structure anymore. Not sure why you think this should work automatically.
If you change the underlying data structure you need to clear structure based states in advance.
There is an example in the NatTable examples application that shows how to change the data provider dynamically. Not sure if the example covers the clearing of states or if this is handled automatically when you are doing things correctly.
Answered By - Dirk Fauth
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)