PDA

View Full Version : Create instance for User Defined Class not working for the first time



sridhar.boganathan
28 Mar 2012, 12:46 AM
Hi All,

I have defined a class which extend from 'Ext.form.Panel'. It has many form fields (fieldcontainer, textboxes, checkboxes, radiobuttons, etc...). I am using Ext.create('MyClass') to instantiate the class.

Here, this instantiating the class is not working for the time. It says 'Object expected'. As per the documentation, Ext.create will work as synchronously.

I am not sure where the problem is.

Please advice,
-Sridhar

dedoz
28 Mar 2012, 2:09 AM
you sure "object expected" is raised in the line that calls Ext.create ?
usually Ext.create will raise something like "this class hasnt been loaded... " or "couldnt find file ..." something like that.
and (i think) to avoid misterious loading problems just adds your files like any js to your html. At the end even sencha/extjs docs tells you loading dinamically is just for development but you have to build a file and then add it like any other js to your html.
this will help debug better also since recognize file names and lines and stuff and most of it its parsed by the browser before using it.

sridhar.boganathan
28 Mar 2012, 4:42 AM
you sure "object expected" is raised in the line that calls Ext.create ?
usually Ext.create will raise something like "this class hasnt been loaded... " or "couldnt find file ..." something like that.
and (i think) to avoid misterious loading problems just adds your files like any js to your html. At the end even sencha/extjs docs tells you loading dinamically is just for development but you have to build a file and then add it like any other js to your html.
this will help debug better also since recognize file names and lines and stuff and most of it its parsed by the browser before using it.

Thanks, I need to make it as synchronous loading (load it whenever need it.). Is there way to load them as synchronously?
just before of Ext.create.

-Sridhar

tobiu
28 Mar 2012, 5:52 AM
if you have the ext.loader enabled, make sure to require your custom class using the requires config at a place that makes sense (e.g. the parent container).

sridhar.boganathan
28 Mar 2012, 6:19 AM
if you have the ext.loader enabled, make sure to require your custom class using the requires config at a place that makes sense (e.g. the parent container).

I have tried with that also. It works as same mentioned.


Ext.Loader.enabled = true;
Ext.syncRequire("students.view.Details");
var childTab = Ext.create('students.view.Details',{
...
...
});
parentTab.add(childTab);

-Sridhar

dedoz
28 Mar 2012, 9:55 AM
are you doing this inside an Ext Application ? or inside a onReady ?
if its inside onReady you need to tell to Ext.Loader where is located "studends" using setPath

sridhar.boganathan
28 Mar 2012, 10:34 PM
are you doing this inside an Ext Application ? or inside a onReady ?
if its inside onReady you need to tell to Ext.Loader where is located "studends" using setPath

I am using Ext.Application. How is it possible with that?

-Sridhar

sridhar.boganathan
30 Mar 2012, 4:10 AM
if you have the ext.loader enabled, make sure to require your custom class using the requires config at a place that makes sense (e.g. the parent container).

Thanks for info.
But I could not use 'requires' config parameter since, I have a lot of classes to be loaded in a class. If those all are mentioned in 'requires', the parent class will be heavily.
Once again I will face the same issue with class which has a lot of classes mentioned in 'requires'.

-Sridhar

sridhar.boganathan
3 Apr 2012, 4:58 AM
Hi All,

Any solution for this?

-Sridhar