如何扩展/覆盖预定义的核心sencha类? [英] How to Extend/Override a predefined core sencha class?
问题描述
我需要对extjs 4.x核心库应用一些更改,以支持render.h中的从右到左的方向。已经知道它不直接操纵ExtJS代码。
I need to apply some changes into extjs 4.x core library to supports right-to-left direction in rendering.i already know its not good to manipulate the ExtJS code directly.
我的问题是:如何通过在ext-all.js之后加载到页面中的另一个js文件来执行此操作?
My question is: How to do this via another js file that loaded into page after the ext-all.js ?
它可能更改预定义sencha类方法通过调用 Ext.apply()
?
its possible to change a predefined sencha class method by calling Ext.apply()
?
推荐答案
真的取决于你需要修改什么。但我相信你的意思是以下内容。
It really depends what exactly you need to modify. But I believe you meant the following.
我有一个名为 ext-mods.js
的文件,之后 ext-all.js
:
I have a file called ext-mods.js
, which is loaded after ext-all.js
:
Ext.onReady(function(){
Ext.override( Ext.data.writer.Json, {
// We want all records sent to the server be encoded as an array,
// even if there's a single record
allowSingle: false,
// We only want to send what have changed
writeAllFields: false
});
});
我已经更改了所有Json Writers的默认配置,但您可以同样覆盖方法(通过复制来自图书馆的代码,然后应用您的修改)。
I have changed the default config for all Json Writers, but you can equally override methods (by copying the code from the library and then apply your modifications).
这篇关于如何扩展/覆盖预定义的核心sencha类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!