2012-03-28 99 views
1

我希望这是我今天的最后一个问题。我发现在设计2.一个不错的选择actioncolumn我添加一个到我的网格,它看起来像这样:如何在extjs的动作列中添加一个按钮

xtype: 'gridpanel', 
         title: 'Reports', 
         forceFit: true, 
         store: 'ReportsStore', 
         columns: [ 
          { 
           xtype: 'gridcolumn', 
           dataIndex: 'Name', 
           text: 'Name' 
          }, 
          { 
           xtype: 'gridcolumn', 
           dataIndex: 'Type', 
           text: 'Type' 
          }, 
          { 
           xtype: 'gridcolumn', 
           dataIndex: 'Description', 
           text: 'Description' 
          }, 
          { 
           xtype: 'actioncolumn', 
           dataIndex: 'Name', 
           items: [ 
            { 
             handler: function(view, rowIndex, colIndex, item, e) { 
              console.log(row, col); 
             }, 
             altText: 'Run report', 
             iconCls: 'runReport' 
            } 
           ] 
          } 
         ], 
         viewConfig: { 

         }, 
         dockedItems: [ 
          { 
           xtype: 'toolbar', 
           dock: 'top', 
           items: [ 
            { 
             xtype: 'tbfill' 
            }, 
            { 
             xtype: 'button', 
             iconCls: 'addReport', 
             text: 'Add report', 
             listeners: { 
              click: { 
               fn: me.onButtonClick, 
               scope: me 
              } 

但并没有什么发生。我想要的是有一个按钮/图标,当你点击它时,它会打开一个ext.window和来自该行的reportId。我无法找到我如何与设计师做这件事。

我现在没有看到图标,所以还没有点击。我错过了什么?

感谢,

TJ

回答

1

您错过收听此按钮:

添加类似的东西到你的项目定义:

handler: function(grid, row, col) { 
    console.log(row, col); 
} 
+0

感谢,我已将此添加到我的代码,但它仍然是一个空的专栏。我编辑了我的代码更多的细节。你能告诉我想念什么吗? – 2012-03-28 13:20:09

+0

你没有看到图标?添加“图标:'somefile.png'”属性。并改变console.log打印出正确的参数 – sha 2012-03-28 13:24:59

+0

谢谢它正在工作! – 2012-03-28 13:38:50