Maybe who knows or can help - the problem is that I need to move column from somewhere from the end of DataFrame to the very beginning. Need to save all tags and options on column and DataFrame as well.
Hi Denis, welcome!
grid.columns.setOrder to programmatically reorder columns:
// Order columns. Columns not mentioned in the parameters will be positioned // after the specified ones. let view = grok.shell.addTableView(grok.data.demo.demog()); view.grid.columns.setOrder(['age', 'sex', 'race']);
No need to change the order. I have 200+ columns and I need to move column “Column-lalala” to be 4-th from the beginning.
Well, moving a column to a new place is exactly changing the order of columns, isn’t it? Here’s a script to move column “Column-lalala” to 4-th position:
let view = grok.shell.addTableView(grok.data.demo.demog()); let order = view.grid.table.columns.names(); let pos = order.indexOf('Column-lalala'); let x = order[pos]; order.splice(pos, 1); order.splice(4, 0, x); view.grid.columns.setOrder(order);
Ok for now. But it would be better to have this feature without (or before) the view.