[code="java"] this.gridPanel = new Ext.grid.GridPanel( {
id : 'gridpanel',
store : this.store,
cm : this.cm,
sm : this.sm,
// trackMouseOver: false,
loadMask : true,
// 超过长度带自动滚动条
autoScroll : true,
border : false,
// collapsible: true,
// animCollapse: false,
stripeRows : true,
viewConfig : viewConfig,
listeners : {
'celldblclick' : {// 双击时执行修改
fn : this.onEdit,
scope : this
},
'contextmenu' : function(e) {
e.stopEvent();
}
},
tbar : this.roleBar,
bbar : this.pToolbar
});
Ext.Ajax.request( {
url : "DATA/control/Permissions.ashx",
// disableCaching:false,
timout : 300,
success : function(response, option) {
if (response.responseText == "") {
return;
}
/*返回的json : [{"id":"ROLE_ADD","text":"添加","iconCls":"page_add","tooltip":"添加新纪录","handler":"this.createAdd"," scope":"this"} ]
*/
this.roleBar = new Ext.Toolbar(eval('('
+ response.responseText + ')'));
this.roleBar.render('gridpanel');
},
failure : function() {
Ext.Msg.alert("提 示", "权限初始化失败!");
},
params : {
id : "addColumns"
}
// timeout:5000,
});
[/code]
// 生成toolbar 以后 为什么 点击按钮事件的时候错误( 对象不支持此属性或方法 ) , 还有 this.roleBar.render(this.gridPanel.tbar); 的时候 this.gridPanel.tbar 不是对象呢 ?
[b]问题补充:[/b]
[code="java"] var grid = new Ext.grid.GridPanel({ });
tbar.render(grid.tbar); [/code]
[color=red] [b]上面的可以为什么下面的这种就不行呢 ?[/b][/color]
[code="java"] this.grid = new Ext.grid.GridPanel({ });
tbar.render(this.grid.tbar); //错误 this.grid 未定义..[/code]