RowEditing和ActionColumn问题

时间:2013-08-30 09:04:05

标签: extjs

我目前遇到RowEditing插件的问题,并且无法找到任何相关内容以帮助我。

我使用RowEditing插件给了一个网格,并被要求添加一行包含" reset"按钮。最好的选择似乎是使用actionColumn。

当行未处于编辑模式时,没有问题,actionColumn正确处理点击,我可以进行处理。 但是,如果行处于编辑模式,那么actionColumn似乎根本没有反应。

我尝试使用编辑器选项,但没有发生任何事情。我也很难使用一些听众,但我找不到任何相关的事件来解决这个问题。

任何想法?

2 个答案:

答案 0 :(得分:0)

最后,我选择了另一种方式:

 {
xtype: 'actioncolumn',
action : 'tarifRowAction',
handler: function (grid, rowIndex, colIndex) 
{
    console.log("got click handler § ");
    me.fireEvent("clickedMAJButton", grid, rowIndex, colIndex);
},
editor: 
{
     xtype: 'button',
     handler: function (grid, rowIndex, colIndex) 
    {
        console.log("got click handler § ");
        me.fireEvent("clickedMAJButton", grid, rowIndex, colIndex);
    },
},
items: [
            {
                 icon: 'images/image16/modifier.png',
                 action : 'tarifRowAction',
                 scope: me
            }
        ]

}

答案 1 :(得分:-1)

您可以使用此方法而不是行编辑插件来实现您的功能:

   {
    xtype: 'actioncolumn',
    width: 50,
    items: [{
             icon: 'edit.png', // Use a URL in the icon config
             tooltip: 'Update',
             handler: function (grid, rowIndex, colIndex) {
                var rec = grid.getStore().getAt(rowIndex);
                alert("Edit " + rec.get('name'));
                rec.set("name", "LISA124"); //Here you may have your logic of updating the data with new data   
               }
             },
             {
              icon: 'reset.png',
              tooltip: 'Reset',
              handler: function (grid, rowIndex, colIndex) {
                  var rec = grid.getStore().getAt(rowIndex);
                  alert("Reset " + rec.get('name'));
                  rec.set("name", rec.raw.name);
                }
              }
             ]
     }

看看这个fiddle

如果您想坚持自己的要求,可以使用@Jeff建议的方法。