PDA

View Full Version : Form - no url specified when it is specified



Webtel
28 Oct 2011, 1:37 AM
I lookup form by :


var f = Ext.ComponentQuery.query('clientform');

than i load it like :

f.load();

and got message no url specified / or ajax connectin error / depending on ext distribution.

but everything works fine when i do it like:

f.load({url:f.url})

Either it has to do with component query by custom xtype, OR maybe, is it possible i did something wrong with define,extend, create ?


Ext.define('TS.view.client.Form', {
extend: 'TS.lib.Form',
alias : 'widget.clientform',
url:URL.form.client,


and TS.libForm is:


Ext.define('TS.lib.Form', {
extend: 'Ext.form.Panel',
frame:true,
fieldDefaults:{
labelAlign:'top'
},
autoScroll:true
});

lucasguaru
28 Oct 2011, 3:29 AM
Hello there,
I had a problem when I was using the configuration on my class definition.
In the documentation you can see the initialConfig is used to create the basicForm.


Note: If subclassing FormPanel, any configuration options for the BasicForm must be applied to the initialConfig property of the FormPanel. Applying BasicForm (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Basic) configuration settings to this will not affect the BasicForm's configuration.

It means if you define your class, these attributes will not be set on your basicForm.
What you have to do is create your form with the url as configuration or set it on constructor.
You can see the answer here:
http://www.sencha.com/forum/showthread.php?152085-Define-a-form-with-trackResetOnLoad-true-is-ignored&highlight=trackResetOnLoad

Webtel
28 Oct 2011, 4:08 AM
yes ... so it could be fixed like this ::



Ext.define('TS.lib.Form', {
initComponent: function() {
this.callParent(arguments);
this.form.url = this.url;
},