How to get a cell in a draggable and movable coulumn grid


I am using a grid where i can drag and rearrange columns. As a result i am not able to get a cell by its index because when i rearrange the columns the index of a cell is changed. I tried getting the cells index dynamically by using getColIndexById(id). but it does not work. How can i get a particular cell in this case where a cells index is not definite and can change any time? Also is there any way i can get the list of headers in a grid or a cells header. By header i mean the column header of the cell.

In that case you can use column ids instead of column indexes:
grid.setColumnIds(ids); - list of ids separated by a delimiter
var colId = grid.getColumnId(ind); // get column id through its index
var colInd = grid.getColIndexById(id); // get column index through its id

After columns moving it’s ids are not changed.