我已经选择了一行,现在我想获取rowIndex也许像
grid.getSelectionModel().getSelection()[0].rowIndex
但是没有定义.我怎么才能得到它谢谢
332nm8kg1#
这个怎么样?
var selectedRecord = grid.getSelectionModel().getSelection()[0]; var row = grid.store.indexOf(selectedRecord);
你必须得到你的网格的选定记录,然后,你可以从你的存储中搜索这个记录,并得到它的索引。
xqnpmsa82#
您也可以从网格的select侦听器中获取它:
select
listeners: { select: function(selModel, record, index, options){ alert(index); } }
mbzjlibv3#
试试看:
grid.getCurrentPosition().row
woobm2wo4#
在ExtJS 7中为:
console.log( 'Selection:', grid.getSelection() ) //One console.log( 'Selection:', grid.getSelectable().getSelectedRecords() ) //Several
k97glaaz5#
如果需要修改网格中的列,可以使用以下代码快照:
{text: 'Status', dataIndex: 'localizedStatus', width: 150, renderer: function(value, meta, record, rowIndex, colIndex, store){ return value; } },
wwwo4jvm6#
尝试
grid.getSelectionModel().getSelection()[0].get('id')
6条答案
按热度按时间332nm8kg1#
这个怎么样?
你必须得到你的网格的选定记录,然后,你可以从你的存储中搜索这个记录,并得到它的索引。
xqnpmsa82#
您也可以从网格的
select
侦听器中获取它:mbzjlibv3#
试试看:
woobm2wo4#
在ExtJS 7中为:
k97glaaz5#
如果需要修改网格中的列,可以使用以下代码快照:
wwwo4jvm6#
尝试