问题
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.
My question is: How to do this via another js file that loaded into page after the ext-all.js ?
its possible to change a predefined sencha class method by calling Ext.apply()
?
回答1:
It really depends what exactly you need to modify. But I believe you meant the following.
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
});
});
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).
回答2:
It is even easier if you are using Sencha Architect. This article explains both approaches.
来源:https://stackoverflow.com/questions/13615817/how-to-extend-override-a-predefined-core-sencha-class