Ext使用:GridPanel之工具栏

grid = new Ext.grid.GridPanel({
       ...
       tbar: contrltar,
       ...
   });

var contrltar = new Ext.Toolbar();
contrltar.add({
                text: '新 增',
                xtype: 'button',
                handler: function() {  }
            });    //按钮
contrltar.add(new Ext.Toolbar.Separator()); //分割线
contrltar.add(new Ext.Toolbar.Spacer()); //空格
contrltar.add('->'); //右对齐
contrltar.add(new Ext.form.TextField({ name: 'key', id: 'KEY' })); //文本框
contrltar.add('类型:'); //文本
contrltar.add(comboItemType); //下拉框
contrltar.add(new Ext.Toolbar.Button({
                text: '搜 索',
                xtype: 'tbbutton',
                handler: function(){}
             });

//定义下拉框
var comboItemType = new Ext.form.ComboBox({
    typeAhead: true,
    triggerAction: 'all',
    lazyRender:true,
    mode: 'local',
    store: new Ext.data.ArrayStore({
        id: 0,
        fields: [
            'myId',
            'displayText'
        ],
        data: [[1, '常规'], [2, '特制']]
    }),
    hiddenName: 'typeid', //取值时用到
    valueField: 'myId',
    displayField: 'displayText'
});

你可能感兴趣的:(js,ext,function,button,工具)