1、How to get selected Rows from a Grid panel in ExtJs 4
get reference to grid selection model could be rowModel or cellModel depending on what was defined in the grid definition selType: 'cellmodel' or selType: 'rowmodel'
seletionModel = grid.getSelectionModel()
get array of the currently selected records
selectedRecords = selectionModel.getSelection()
get the value of given field definition from the first selected row
myValue = selectedRecords[0].get('fieldName')
loop thru selectedRecords for more records if MULTI selection was allowed
2、How to get selected Cells from a Grid panel in ExtJs 4
To get selected cell you must used selType = cellModel. After you get reference to the selectionModel as defined above use
getCurrentPosition( )
Returns the current position in the format {row: row, column: column}
After you have the current row and column get the grid view to access the cell
cell = grid.getView().getCellByPosition({row: obj.rowIdx, column: obj.colIdx});
get reference to grid selection model could be rowModel or cellModel depending on what was defined in the grid definition selType: 'cellmodel' or selType: 'rowmodel'
seletionModel = grid.getSelectionModel()
get array of the currently selected records
selectedRecords = selectionModel.getSelection()
get the value of given field definition from the first selected row
myValue = selectedRecords[0].get('fieldName')
loop thru selectedRecords for more records if MULTI selection was allowed
2、How to get selected Cells from a Grid panel in ExtJs 4
To get selected cell you must used selType = cellModel. After you get reference to the selectionModel as defined above use
getCurrentPosition( )
Returns the current position in the format {row: row, column: column}
After you have the current row and column get the grid view to access the cell
cell = grid.getView().getCellByPosition({row: obj.rowIdx, column: obj.colIdx});
ExtJS4网格选择教程
本文介绍了如何在ExtJS4中从网格面板获取选中的行和单元格。首先讲解了如何通过选择模型获取当前选中的记录,然后展示了如何在允许多选的情况下遍历这些记录。此外,还详细说明了当使用单元格选择模型时,如何获取当前选中的单元格位置及其相关信息。
4772

被折叠的 条评论
为什么被折叠?



