日期:2014-05-16  浏览次数:20320 次

ExtJs的resultGrids中动态添加按钮

var resultGrids = Ext.getCmp("resultGrid");
??resultGrids.getView().on("refresh",doRefresh);

?

//添加查看按钮
?var doRefresh = function(view) {
??//alert("99999");
??for(var i = 0; i <view.currentCount; i++)
??{
???for(var j = 0;j < view.cm.config.length;j++){
????
????
????if(view.cm.config[j].id=="handler"){
?????//获取单元格button对象
?????//alert("888");
?????var cell = view.getCell(i,j);
?????var bid = Ext.id();??
????????? cell.innerHTML ='<table border=0 width=40 cellspacing=0 cellpadding=0><tr><td><div id='+bid+'></div></td></tr></table>';
??????var button=new Ext.Button({
???????text:"查看",
???????renderTo:bid,
???????id:bid,
???????record:view.ds.getAt(i)?,
???????handler:checkSon???????
??????});??????
?????
????}
???}
??}??
?}

?

?

function checkSon() {
?????? ??var checkId = this.record.get('checkId');
???//alert(checkId);
???//var url='/op/aget/commercialpos_out.jsp?posId='+encodeURI(encodeURI(posId));
???var url='/op/shanghu/sub_shanghu_update.jsp?checkId='+checkId;
???app.getPortal().contMgr.switchContent(url,true);
???
??????? };

?

?

?

?