Extjs grid中tbar(按钮栏Toolbar)的按钮显示成多行的方法总结

方法1:按钮从数据库中加载

//----------------grid  wafer按钮事件----------------
var GridtbarWafer = new Ext.Toolbar({height:27});
function addButtonWafer1() {
    if (GridtbarWafer.rendered) {
        var buttons = rbacobjectwafer.getButtonNames();
        for (var i = 0; i < 5; i++) {
            var tmpbutton = Ext.getCmp(buttons[i]);
            GridtbarWafer.addButton(tmpbutton);
        }
    } else {
        GridtbarWafer.addListener('render', addButtonWafer1);
    }
}
;
rbacobjectwafer.on('AfterLoad', addButtonWafer1);
var GridtbarWafer2 = new Ext.Toolbar({height:27});
function addButtonWafer() {
    if (GridtbarWafer2.rendered) {
        var buttons = rbacobjectwafer.getButtonNames();
        for (var i = 5; i < buttons.length; i++) {
            var tmpbutton = Ext.getCmp(buttons[i]);
            GridtbarWafer2.addButton(tmpbutton);
        }
    } else {
        GridtbarWafer2.addListener('render', addButtonWafer);
    }
}
;
rbacobjectwafer.on('AfterLoad', addButtonWafer);
//具体Wafer 的grid
var CustomerWaferGrid = new Ext.grid.GridPanel({
    id : 'CustomerWaferGrid',
    ds : dsCustomerWaferList,
    cm : cmCustomerWaferList,
    sm : smCustomerWaferList,
    tbar : GridtbarWafer,
        listeners : {
         'render' : function() {
          GridtbarWafer2.render(this.tbar);
         }
        }

});

方法2:固定的按钮

var grid = new Ext.grid.GridPanel({

//grid其他属性,
tbar : ['用户姓名: ', {
       xtype : 'textfield',
       id : 'description',
       width : 120
      },
      '创建时间: ', {
       id : 'startdate',
       xtype : 'datefield',
       format : 'Y-m-d'
      }, '至', {
       id : 'enddate',
       xtype : 'datefield',
       format : 'Y-m-d'
      }, '-', {
       text : '查询',
       iconCls : 'page_findIcon',
       xtype:"button",
       handler:function(){ds.load();}
      }],
    listeners : {
     'render' : function() {
      var tbar = new Ext.Toolbar({
         items : [{
            text : '新增',
            iconCls : 'addIcon',
            xtype : "button",
            handler : function() {
             win.add(f);
             win.show();
            }
           }, {
            text : '修改',
            iconCls : 'edit1Icon'
           }, {
            text : '删除',
            iconCls : 'deleteIcon'
           }, '-', {
            text : '导出PDF',
            iconCls : 'pdfIcon'
           }, {
            text : '导出 Excel',
            iconCls : 'excel'
           }, '-', {
            text : '打印',
            iconCls : 'printerIcon'
           }]
        });
      tbar.render(this.tbar);
     }
    }

});

方法3:

// create the editor grid   

  •     var grid = new Ext.grid.EditorGridPanel({   
  •         store: store,   
  •         cm: cm,   
  •         renderTo: 'editor-grid',   
  •         width:600,   
  •         height:300,   
  •         autoExpandColumn:'common',   
  •         title:'Edit Plants?',   
  •         frame:true,   
  •         plugins:checkColumn,   
  •         clicksToEdit:1,   
  •   
  •         tbar: new Ext.Toolbar({   
  •             autoWidth:true,   
  •                 autoShow:true,   
  •             items:[   
  •             {text: 'there is a add button for test'},   
  •                '-',   
  •                '->',   
  •                {text: 'there is a update button for test'},   
  •                   
  •                 {text: 'there is a delete button for test'}   
  •         ]   
  •          })   
  •     });   
  •   
  •   
  • this.bbar2 = new Ext.Toolbar({   
  •             renderTo:grid.tbar   
  •             ,items:['Example of second toolbar''-', {   
  •                  text:'Button'  
  •                 ,iconCls:'icon-key'  
  •             }, '-'  
  •             ]   
  •         });   
  •   
  •   
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值