繁体   English   中英

在ExtJS的网格标题中添加组合框编辑器

[英]add combo box editor in grid header in ExtJS

我们可以在extjs的网格标题中添加组合框吗?

我们这里有特殊要求,如果有人有想法,请告诉我。

谢谢迪帕克

如果你想在网格列标题中使用它(例如实现自定义过滤器),请查看http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/build/KitchenSink/ext-theme-海王星/#大数据网格

基本上,您可以在列配置中配置项目,然后离开:

Ext.define('KitchenSink.view.grid.BigData', {
    extend: 'Ext.grid.Panel',
    columns: [
        {
            xtype: 'gridcolumn',
            dataIndex: 'status',
            text: 'Item status'
            items: [
                {xtype: 'combobox'}
            ]

        }
    ]
});

您可以使用extjs tbar将组件实现到网格标题:

tbar: [
   { xtype: 'button', text: 'Button 1' }
]

要么:

dockedItems: [{
    xtype: 'toolbar',
    dock: 'top',
    items: [
         { xtype: 'button', text: 'Button 1' }
    ]
}]

实现combobox ,最好的方法是定义自定义组合框组件并为它提供alias ,然后在你的网格tbar中只说xtype: 'mygridcombo'

这是一个例子

这对我很有用

 {
    text     : 'Save Energy Mode',
    dataIndex: 'fs',
    items: [{
      xtype: 'combobox',
      padding: 2,
      flex: 1
    }]
  }

或者简单地说(如果你不需要标题文本)

     columns: { items: [{ xtype: 'combobox'}] }

如果你可以在网格面板的工具栏中找到它,那么Davor的建议就是你要走的路。 如果你真的需要它在网格的标题中(例如,就像对列进行过滤一样),你可以查看Ext JS文档中的网格过滤示例: http//docs.sencha.com/extjs/4.2.1/# !/example/grid-filtering/grid-filter-local.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM