简体   繁体   English

Ext JS,全局更改网格列配置默认值

[英]Ext JS, change grid column configs default values globally

Ext.grid.column.Column class has following configs: Ext.grid.column.Column类具有以下配置:

  • draggable (Defaults to: true) 可拖动的 (默认为:true)
  • sortable (Defaults to: true) 可排序 (默认为:true)
  • menuDisabled (Defaults to: false) menuDisabled (默认为:false)

Is it possible to change default values of this configs globally for all grid columns in my application ? 是否可以为我的应用程序中的所有网格列全局更改此配置的默认值?

Any help appreciated. 任何帮助表示赞赏。

Given that the accepted answer is for ExtJS 5.x, I thought it would be useful to have an answer for ExtJS 4.x too. 鉴于可接受的答案是针对ExtJS 5.x的,所以我认为也有针对ExtJS 4.x的答案会很有用。

Something like the following should do it: 应该执行以下操作:

  Ext.define('Ext.my.grid.column.Column', {
    override : 'Ext.grid.column.Column',
    draggable : false,
    sortable : false,
    menuDisabled : true
  });

Now every time you use a column in a grid, it will take these as defaults. 现在,每次您在网格中使用一列时,都会将其作为默认值。

yes, using Ext.override...... 是的,使用Ext.override ......

http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext-method-override http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext-method-override

example... 例...

Ext.override(Ext.grid.column.Column, {
 draggable: true,
 sortable: true,
 menuDisabled: false
});

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

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