给ExtJS的Grid增加两行tbar

按照需要,我们一般在Grid的上方放置一个toolbar,再在上面放一些输入控件做查询用,但是同时我们也需要在上面添加一些其他按钮,比如“新增”,“删除”,“修改”,“导出”等,但是这些按钮要是放置查询的那个tbar上的话,感觉不太好,最好将分成两排。

我们先看看截图:

代码如下:

//Grid其他代码省略
tbar : [{
            xtype : 'hidden',
            id : 'action',
            value : 'QUERY_T_SYS_USER_ACTION'
        }, '用户姓名: ', {
            xtype : 'textfield',
            id : 'description',
            width : 120
        }, new Ext.Toolbar.TextItem("    "),
        '创建时间: ', {
            id : 'itemDateFrom',
            xtype : 'datefield',
            format : 'Y-m-d',
            readOnly : true
        }, '至', {
            id : 'itemDateTo',
            xtype : 'datefield',
            format : 'Y-m-d',
            readOnly : true
        }, '-', {
            text : '查询',
            iconCls : 'query',
            handler : function() {
                store.load({
                            params : {
                                start : 0,
                                limit : 25,
                                USER_NAME : Ext.get('description').dom.value,
                                action : Ext.get('action').dom.value
                            }
                        })
            }
        }],
listeners : {
    'render' : function() {
        var tbar = new Ext.Toolbar({
                    items : [{
                                text : '新增',
                                iconCls : 'add'
                            }, {
                                text : '修改',
                                iconCls : 'modify'
                            }, {
                                text : '删除',
                                iconCls : 'delete'
                            }, '-', {
                                text : '导出PDF',
                                iconCls : 'pdf'
                            }, {
                                text : '导出Excel',
                                iconCls : 'excel'
                            }, '-', {
                                text : '打印',
                                iconCls : 'print'
                            }]
                });
        tbar.render(grid.tbar);
    }
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值