简体   繁体   English

自定义Ext.js网格面板的标题

[英]Customizing Ext.js grid panel's title

Is there a way to customize the title of ext.js grid panel (or is there a more generic way of customizing panel title) by adding custom controls to it, and not tool buttons? 有没有一种方法可以通过向其添加自定义控件而不是工具按钮来自定义ext.js网格面板的标题(或者有一种更通用的自定义面板标题的方法)?

I am tring to add a search field to the title, but with current existing implementation (found in the ux/grid example) it is shown how filter can be added to the drop down menu of the grid's title, and not to the title itself, which is what I am trying to achieve.. 我正试图在标题中添加搜索字段,但是使用当前现有的实现(在ux / grid示例中找到),将显示如何将过滤器添加到网格标题的下拉菜单中,而不是添加到标题本身,这是我想要实现的目标。

Any clue? 有什么线索吗?

Header is a container with hbox layout so you can add/remove items to it as to any other container. 标头是具有hbox布局的容器,因此您可以像添加其他任何容器一样向其添加/删除项目。 You can test it (for example) here: http://extjs.eu/apps/saki-writable-grid/ by typing 您可以在此处进行测试(例如): http ://extjs.eu/apps/saki-writable-grid/

Ext.ComponentQuery.query('maingridview')[0].getHeader().add({xtype:'textfield'});

in the console. 在控制台中。 The textfield appears at the header right. 文本字段显示在标题右侧。

As to grid filtering, see Grid Search Plugin that can be added also to the grid header. 关于网格过滤,请参见也可以添加到网格标题的Grid Search插件

Have a look at the grid panel's header config, where you can set any configuration option of Ext.panel.Header . 看一下网格面板的header配置,您可以在其中设置Ext.panel.Header任何配置选项。 As it is a container, you can just specify its items there: 由于它是一个容器,因此您可以在此处指定其items

header: {
    title: 'Test',
    titlePosition: 0,
    items: [{
        xtype: 'textfield'
    }]
}

Also check out this fiddle . 还要检查这个小提琴

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

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