What I just described shows how the number of columns will always correspond with the highest numbered column for which a getColumnDefinition was called. It is now new behavior that if you call removeColumnDefinition on the last (i.e. highest numbered) column, then the columnCount will decrease.
Since there is no way to bind the Array of RowColumnDefinitions, since that property doesn’t exist on the Panel class, you have to have some code that does the update.
But in any case it appears that the semantics of the Panel.columnCount property do not match what you were looking for. So, don’t use it for whatever purposes you have.
The reason applyIncrementalJson doesn’t “work” is for the same reason – the state of the columns is not bindable/settable. You’ll need to modify them programmatically.
I was suggesting what I would do if I were you. We’re not going to change the implementation of “Table” Panels except to fix bugs, of which I know none at this time.
If we feel those problem is not a bug, we should delete the addRemoveColumnsAdd or Remove Columns
from web site, I think it misleading people code wrong.
For each modified node data, find the corresponding existing Node and its “Table” Panel, and then iterate through the new “columnDefinitions” Array and make sure its information is properly reflected in the panel’s actual column definitions.
That includes calling Panel.removeColumnDefinition on any columns that are not represented in the new “columnDefinitions” Array. For example, when column 3 has been removed. It is this step that your code is missing.
Remember that this extra work is required because there is no way to set or bind the internal Array of column definitions combined with that Array allowing null/undefined entries.