How to determine the selected cell of a Ext.grid.Panel in ExtJS 4?

13,080

Solution 1

There may be a more direct way to do this but the following seems to work for me:

grid.view.getCellByPosition(grid.getSelectionModel().getCurrentPosition());

Solution 2

I ended up needing the actual column that the user was clicking on and discovered the following:

grid.panel.columns[grid.getSelectionModel().getCurrentPosition().column]

Don't forget to apply:

    selType : 'cellmodel'

to your grid to make sure you can select cells!

Share:
13,080
Sebastian
Author by

Sebastian

Updated on June 28, 2022

Comments

  • Sebastian
    Sebastian almost 2 years

    how can i get the selected cell of a Ext.grid.Panel? In ExtJS 3 it was possible via:

    grid.getSelectionModel().getSelectedCell()
    

    In Ext 4 there is

    grid.getSelectionModel().selected
    

    but this only gives me the record.

  • Sebastian
    Sebastian almost 13 years
    I'm not at work anymore, so i can't try... What i did as a workaround, was to 'misuse' the select-event and store the cell and column in an own variable.
  • Craig
    Craig almost 13 years
    Yeah, that was my first thought too, until I read through the source code and came up with the above!