Ext JS, change grid column configs default values globally

一笑奈何 提交于 2020-01-15 08:59:07

问题


Ext.grid.column.Column class has following configs:

  • draggable (Defaults to: true)
  • sortable (Defaults to: true)
  • menuDisabled (Defaults to: false)

Is it possible to change default values of this configs globally for all grid columns in my application ?

Any help appreciated.


回答1:


yes, using Ext.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
});



回答2:


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.

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.



来源:https://stackoverflow.com/questions/30003819/ext-js-change-grid-column-configs-default-values-globally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!