View Full Version : Ext.form.Panel doesn't allow to defined a api object
It should be possible to define an api object like this:
api: { load: SomeStub.load, submit:SomeStub.submit }
currently Ext Designer generates:
api: '{ load: SomeStub.load, submit:SomeStub.submit }'
Tested on Mac OS X Lion with Ext Designer 2.0 build 298
best regards
Roland
bharatn
1 Mar 2012, 8:51 AM
Hi Roland,
We recently opened a ticket for this DSGNR-1393. This should be resolved in the coming weeks.
Thanks
Dumas
4 Mar 2012, 11:23 AM
If someone else is also using Ext Designer with FormPanels and API, here's a override which makes the Designer code work proper (for build 298):
// just change the following line
var className = 'MyApp.view.ui.CommentForm';
// you don't have to care about this
Ext.require([className], function() {
var classObj = Ext.ClassManager.get(className),
classPrototype = classObj.prototype,
fixApiConfig = function(api) {
if(Ext.isString(api)) {
var stringToObject = new Function("return "+api);
return stringToObject();
} else {
return api;
}
};
// Ext Designer defines the api two times, so we need to
// overwrite two times as well
Ext.define(className+'Overrride', {
override: className,
// override the designer config
api: fixApiConfig(classPrototype.api),
// override the designer initComponent config
constructor : function(config) {
if(!config.api) {
config.api = fixApiConfig(classPrototype.api);
}
this.callParent([config]);
}
});
});
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.