Ext JS grid get dom of last selected row

依然范特西╮ 提交于 2019-12-11 02:56:40

问题


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:


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);


来源:https://stackoverflow.com/questions/21403955/ext-js-grid-get-dom-of-last-selected-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!