2012-02-15 70 views
3

我需要在網格內的鏈接上添加單擊事件,該如何工作?單擊網格列中的鏈接時的調用函數

這是我的網格:

Ext.define('AM.view.advertiser.List', { 
    extend:'Ext.grid.Panel', 
    alias:'widget.advertiserlist', 
    title:'All Advertisers', 
    store:'Advertisers', 
    columns: [ 
    { 
      xtype:'gridcolumn', 
      dataIndex:'clientname', 
      text:'Clientname', 
      width: 200, 
      renderer: function(val) { 
        return '<a href="#">'+ val +'</a>'; 
      } 
    }] 
}); 

enter image description here

回答

1

這裏是我砍死完全相同的情況,但我想控制器的點擊響應事件,我需要hashmark後提取信息:

'myView gridpanel[ref=myGrid]':{ 
        itemclick : function(view, model, row, rowindex, event) { 
         var hash = event.getTarget().hash; 
         if (!hash && event.getTarget().parentNode) { 
          hash = event.getTarget().parentNode.hash 
         } 
         if(hash) { 
          console.log("Control: "+hash); 
          //do something with the hash -> #{mydata} 
         } 
        } 

      } 
0
xtype:'gridcolumn', 
dataIndex:'clientname', 
text:'Clientname', 
width: 200, 
autoEl:{ 
    tag: 'a', 
    href: '', 
    onClick: 'nameYouFunction', 
    //Any methods to add here 
} 
相關問題