Our blazing fast Grid component built with pure JavaScript


Post by MattSlalom »

Is there any way to re order/sort the columns themselves via code? I have tried messing with the column store a bit and overriding it manually (changing the grid.columns.data as well as trying to change the gird.columns columnStore), but I know that isn't a good way to achieve this. It also yields some strange behavior where it adds a region splitter each update. I have been perusing through the docs and haven't found anything that seems good. columnStore.move sounds promising but I am unsure of the params it wants, my guess is the entire column object, or if it's even an appropriate solution.

Thanks in advance for any help


Post by saki »

Grid can have regions that should be considered while doing a programmatic column reorder. The best would be if you analyzed how feature ColumnReorder does it in onDrop method. You can set a breakpoint there and then step through the code to find out what's happening there.

The file is lib/Grid/feature/ColumnReorder.js


Post by jhughesoneplan »

Is there a way to get a bit of code here? I am a current extjs customer but am evaluating your stand alone gantt for purchase and dont have the source yet. I want to make sure reordering of columns is possible via code. Thank you.


Post by mats »

https://bryntum.com/docs/scheduler/#Grid/data/ColumnStore is just a regular store, so any of the common Store APIs can be used:

For example

grid.columns.move(grid.columns.getAt(0), grid.columns.getAt(3))

Post by jhughesoneplan »

I thought that might be the way but I tried using it with no luck. I tried exactly your code and nothing moves. Is there more that needs to be done after you do the move call? I notice the category is grid, I am using the gantt but I assume it should be using the same function?


Post by mats »

Will look into that, try https://bryntum.com/docs/scheduler/#Grid/data/ColumnStore#function-insert

gantt.columns.insert(1, gantt.columns.getAt(4))

Post by jhughesoneplan »

That worked for me thank you


Post Reply