Ext Tollbar 动态添加按钮 留着以后用


0

Ext Toolbar 动态添加按钮5

Java代码   收藏代码
  1. var toolBar = new Ext.Toolbar({});  
  2. var bb = {  
  3.     text : 'TEXT',  
  4.     id : 'bb_id'  
  5. }  
  6. var button = new Ext.Button({  
  7.     text : 'ADD',  
  8.     renderTo : 'button_id',  
  9.     handler : function(){  
  10.         //add button for toolbar  
  11.                 toolBar.items.add('bb_id',bb); //This is not work  
  12.     }  
  13. })  
2009年11月09日 11:18

采纳的答案

Notes : 

    * If the Container is already rendered when add is called, you may need to call doLayout to refresh the view which causes any unrendered child Components to be rendered. This is required so that you can add multiple child components if needed while only refreshing the layout once. For example: 

      var tb = new Ext.Toolbar(); 
      tb.render(document.body);  // toolbar is rendered 
      tb.add({text:'Button 1'}); // add multiple items (defaultType for Toolbar is 'button') 
      tb.add({text:'Button 2'}); 
      tb.doLayout();             // refresh the layout 



意思就是动态添加后,需要调用toolbar的doLayout()刷新一下布局

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值