ExtJs_tbar之国士无双

  国士无双是说只有一个吧?算了,忽略那些个细节.之前做页面的时候要给查询做参数,单独写出来看起来好难看.就想放tbar上,瞬间感觉小清新.可是问题就来了,有的时候检索条件会很多,可是tbar的长度最多也就屏幕宽度吧?就想着能不能换行,网上好多跟我想法一样的,可是那些以讹传讹的办法真的好么?自己肯定都没试过. 哼 → . → ~

 1 // 第二个工具栏
 2     var tbar2 = new Ext.Toolbar({
 3                 renderTo : Ext.grid.GridPanel.tbar,// 其中grid是上边创建的grid容器
 4                 items : ["-", '开始时间', {
 5                             xtype : 'textfield',
 6                             id : 's_stime',
 7                             fieldLabel : '开始时间',
 8                             name : 's_startTime',
 9                             value : myDate1.format('Y-m-d H:i:s'),
10                             width : 140,
11                             cls : 'Wdate',
12                             listeners : {
13                                 'focus' : function() {
14                                     WdatePicker({
15                                                 skin : 'ext',
16                                                 dateFmt : 'yyyy-MM-dd HH:mm:ss',
17                                                 maxDate : '%y-%M-%d'
18                                             })
19                                 }
20                             }
21                         }, "-", '结束时间', {
22                             xtype : 'textfield',
23                             id : 's_etime',
24                             fieldLabel : '结束时间',
25                             value : myDate2.format('Y-m-d H:i:s'),
26                             width : 140,
27                             name : 's_endTime',
28                             cls : 'Wdate',
29                             listeners : {
30                                 'focus' : function() {
31                                     WdatePicker({
32                                                 skin : 'ext',
33                                                 dateFmt : 'yyyy-MM-dd HH:mm:ss',
34                                                 maxDate : '%y-%M-%d'
35                                             })
36                                 }
37                             }
38                         }, "-", {
39                             text : '查询',
40                             iconCls : 'icon_query',
41                             handler : function() {
42                                 // alert(document.getElementById('s_endTime').value)
43                                 searchFun();
44                             }
45                         }, "-"]
46 
47             });

  补个Date?

1     var myDate1 = new Date();
2     myDate1.setDate(myDate1.getDate() - 7);
3     var myDate2 = new Date();

  然后对tbar做监听,把第二个塞进去

1 listeners : { // 将第二个bar渲染到tbar里面,通过listeners事件
2             'render' : function() {
3                 tbar2.render(this.tbar);
4             }
5         }

  这是我在解决过成功,搜索到有位仁兄做的,当时只把代码改动了一下测试成功了.然后我做记录的是记录的自己写的...- -# 在此对那位仁兄表示敬意,出处现已不甚明了.所以...嘿嘿~咱们都是为了进步嘛!

 

  叶落星辰  W

posted @ 2015-01-14 16:59  ZhLingF  阅读(301)  评论(0编辑  收藏  举报