Ext JS grid get dom of last selected row

2019-07-17 20:20发布

Is there any chance to get the DOM values of the last selected row inside a grid. I could only get the record with values and not the DOM elements. With DOM elements I mean the <tr> element of the row selected.

var selectedRecord = grid.getSelectionModel().getLastSelected();

//only gets the model instance that is selected

1条回答
Root(大扎)
2楼-- · 2019-07-17 20:42

You can use grid's view getNode() method. It returns HTMLElement of the grid record's row. If you want to do something with row HTML element you can use Ext.get() method to obtain Ext.dom.Element object.

// selected record
var selectedRecord = grid.getSelectionModel().getLastSelected();

// row HTMLElement
var node = grid.view.getNode(selectedRecord);

// Ext.dom.Element object
var el = Ext.get(node);
查看更多
登录 后发表回答