1. #1
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    94
    Answers
    1
    Vote Rating
    0
    sridhar.boganathan is on a distinguished road

      0  

    Default Unanswered: Create instance for User Defined Class not working for the first time

    Unanswered: Create instance for User Defined Class not working for the first time


    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


  2. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    219
    Answers
    13
    Vote Rating
    9
    dedoz will become famous soon enough

      0  

    Default


    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.

  3. #3
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    94
    Answers
    1
    Vote Rating
    0
    sridhar.boganathan is on a distinguished road

      0  

    Default


    Quote Originally Posted by dedoz View Post
    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

  4. #4
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    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).
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  5. #5
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    94
    Answers
    1
    Vote Rating
    0
    sridhar.boganathan is on a distinguished road

      0  

    Default


    Quote Originally Posted by tobiu View Post
    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.
    Code:
    Ext.Loader.enabled = true;
    Ext.syncRequire("students.view.Details");
    var childTab = Ext.create('students.view.Details',{
        ...
        ...
    });
    parentTab.add(childTab);
    -Sridhar

  6. #6
    Sencha User
    Join Date
    Dec 2011
    Posts
    219
    Answers
    13
    Vote Rating
    9
    dedoz will become famous soon enough

      0  

    Default


    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

  7. #7
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    94
    Answers
    1
    Vote Rating
    0
    sridhar.boganathan is on a distinguished road

      0  

    Default


    Quote Originally Posted by dedoz View Post
    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

  8. #8
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    94
    Answers
    1
    Vote Rating
    0
    sridhar.boganathan is on a distinguished road

      0  

    Default


    Quote Originally Posted by tobiu View Post
    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

  9. #9
    Sencha Premium Member
    Join Date
    Dec 2011
    Posts
    94
    Answers
    1
    Vote Rating
    0
    sridhar.boganathan is on a distinguished road

      0  

    Default


    Hi All,

    Any solution for this?

    -Sridhar

Thread Participants: 2