1
votes

I'm working with a grid with several columns of data. I want the user to be able to move the columns around (by setting the enableColumnMove property to true on the grid) but I also need to be able to reset the column order to what I initiate the grid with.

There is no method to change a column's dataIndex property after it has been created. Is there a different way to go about this?

1

1 Answers

2
votes

You can use grid.reconfigure(null, grid.initialConfig.columns) to reset the grid back to its original state. The first parameter is for setting a new store on the grid, but if you leave it null/undefined then the grid store will be unaffected.

Be aware that the reconfigure method may have unintended side-effects with locked grids and grids with nested column headers. But for most grids, it should work fine.