简体   繁体   English

如何获取gridPanel单元值? 扩展名

[英]How to get gridPanel cell value? ExtJs

I have a gridPanel with ColumnModel . 我有一个带有ColumnModel的gridPanel。 One of this columns is ActionColumn with buttons. 此列之一是带有按钮的ActionColumn And i want by click a button get a cell value from cell in same row with this button? 我想通过单击按钮从与此按钮同一行的单元格中获取单元格值? How to do this? 这个怎么做?

My ActionColumn 我的动作专栏

{
        xtype: 'actioncolumn',
        width: 50,
        items: [{
               icon   : url_servlet+'externals/gxp/src/theme/img/pencil.png', 
            tooltip: 'Редактировать участок',
            handler: function(grid, rowIndex, colIndex) {
            alert("DAMACIA!!!!");
           }

You have all you need in handler params 您拥有处理程序参数中所需的一切

handler: function(grid, rowIndex, colIndex) {
            var row = grid.getStore().getAt(rowIndex);
            console.log(row);
           }

The code above will give you the row, so you just need to select desired cell. 上面的代码将为您提供该行,因此您只需选择所需的单元格即可。

If you enforce selection before clicking actioncolumn you can also use code below. 如果您在单击操作列之前强制执行选择,则还可以使用以下代码。 But be aware by default clicking on actioncolumn doesn't fire selection, so while clicking actioncolumn an entirely different row can be selected or even no column can be selected at all. 但是请注意,默认情况下,单击动作列不会触发选择,因此在单击动作列时,可以选择完全不同的行,甚至根本不能选择任何列。

grid.getSelectionModel().getSelection()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM