EXTJS 中toolbar換行


如果EXTJS 中toolbar中控件太多,不換行顯示的話,整個界面就會出現標題欄和下面數據顯示部分寬度不一的情況。

在EXTJS 3.0版本中開始有buttongroup組件,可以實現換行了。

但是在3.0以前的版本中要實現換行其實也比較簡單,方法如下:

//先定義幾個Toolbar:

var oneTbar=new Ext.Toolbar({ 

 items:[ 

 {text:'複製'}, {text:'粘貼'} ]

 }); 

var twoTbar=new Ext.Toolbar({ 

 items:[ 

 {text:'編輯}, {text:'刪除'} ]

 }); 

//在grid中增加listeners ::

var grid = new Ext.grid.GridPanel({
        id:'button-grid',
        store: store,
        cm: cm,
        ...........

       tbar:[{text:'查詢'}, {text:'搜索'} ]

       listeners : { 
           'render' : function(){ 
            oneTbar.render(this.tbar); //add one tbar 
            twoTbar.render(this.tbar); //add two tbar 
            }},

       renderTo:document.getElementById("Mygrid")

   });


 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章