Harvest Fly

          Java,Web,Ajax
          隨筆 - 8, 文章 - 5, 評(píng)論 - 15, 引用 - 0
          數(shù)據(jù)加載中……

          給ExtJS的Grid增加兩行tbar

          按照需要,我們一般在Grid的上方放置一個(gè)toolbar,再在上面放一些輸入控件做查詢用,但是同時(shí)我們也需要在上面添加一些其他按鈕,比如“新增”,“刪除”,“修改”,“導(dǎo)出”等,但是這些按鈕要是放置查詢的那個(gè)tbar上的話,感覺不太好,最好將分成兩排。
          我們先看看截圖:

          代碼如下:
           1 //Grid其他代碼省略
           2 tbar : [{
           3             xtype : 'hidden',
           4             id : 'action',
           5             value : 'QUERY_T_SYS_USER_ACTION'
           6         }, '用戶姓名: ', {
           7             xtype : 'textfield',
           8             id : 'description',
           9             width : 120
          10         }, new Ext.Toolbar.TextItem("    "),
          11         '創(chuàng)建時(shí)間: ', {
          12             id : 'itemDateFrom',
          13             xtype : 'datefield',
          14             format : 'Y-m-d',
          15             readOnly : true
          16         }, '至', {
          17             id : 'itemDateTo',
          18             xtype : 'datefield',
          19             format : 'Y-m-d',
          20             readOnly : true
          21         }, '-', {
          22             text : '查詢',
          23             iconCls : 'query',
          24             handler : function() {
          25                 store.load({
          26                             params : {
          27                                 start : 0,
          28                                 limit : 25,
          29                                 USER_NAME : Ext.get('description').dom.value,
          30                                 action : Ext.get('action').dom.value
          31                             }
          32                         })
          33             }
          34         }],
          35 listeners : {
          36     'render' : function() {
          37         var tbar = new Ext.Toolbar({
          38                     items : [{
          39                                 text : '新增',
          40                                 iconCls : 'add'
          41                             }, {
          42                                 text : '修改',
          43                                 iconCls : 'modify'
          44                             }, {
          45                                 text : '刪除',
          46                                 iconCls : 'delete'
          47                             }, '-', {
          48                                 text : '導(dǎo)出PDF',
          49                                 iconCls : 'pdf'
          50                             }, {
          51                                 text : '導(dǎo)出Excel',
          52                                 iconCls : 'excel'
          53                             }, '-', {
          54                                 text : '打印',
          55                                 iconCls : 'print'
          56                             }]
          57                 });
          58         tbar.render(grid.tbar);
          59     }
          60 }

          posted on 2009-05-21 17:47 harvestfly 閱讀(3709) 評(píng)論(5)  編輯  收藏 所屬分類: ExtJS

          評(píng)論

          # re: 給ExtJS的Grid增加兩行tbar  回復(fù)  更多評(píng)論   

          有源碼沒?
          2009-05-22 01:33 | 虎嘯龍吟

          # re: 給ExtJS的Grid增加兩行tbar  回復(fù)  更多評(píng)論   

          很好,感謝
          2010-02-04 17:14 | wyb_009

          # re: 給ExtJS的Grid增加兩行tbar[未登錄]  回復(fù)  更多評(píng)論   

          maybe it will help you https://www.extjs.com/forum/showthread.php?t=94762
          2010-03-20 20:04 | Jet

          # re: 給ExtJS的Grid增加兩行tbar  回復(fù)  更多評(píng)論   

          樓主能給個(gè)源碼嗎,謝謝了......pf520025@126.com
          2010-04-26 11:27 | 321

          # re: 給ExtJS的Grid增加兩行tbar  回復(fù)  更多評(píng)論   

          為什么我一把這段代碼加進(jìn)去會(huì)顯示typeerror 的問題呢
          2013-10-23 15:38 | 大神一步一步走

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 新巴尔虎左旗| 丰城市| 陆河县| 通城县| 长顺县| 虹口区| 县级市| 肃南| 宣威市| 哈巴河县| 二连浩特市| 宜君县| 白河县| 乌什县| 亳州市| 胶南市| 宣城市| 包头市| 东辽县| 天台县| 迁西县| 中阳县| 岐山县| 桂林市| 浦北县| 友谊县| 鄂温| 周口市| 辽阳市| 福海县| 潢川县| 新郑市| 富裕县| 化州市| 大同市| 杨浦区| 嘉善县| 信阳市| 巩义市| 兴业县| 桃江县|