1. #1
    Sencha User
    Join Date
    Oct 2007
    Posts
    40
    Vote Rating
    0
    Answers
    1
    bsklar is on a distinguished road

      0  

    Default Answered: Ext.data is undefined

    Answered: Ext.data is undefined


    I'm trying to get my code to work with the b1 release and I am getting the message of
    Ext.data is undefined for the following code:

    Code:
     var store = new Ext.data.TreeStore({
         model: 'ListItem',
         defaultRootProperty: 'items',
         root: data                    // the list of dogs
     });
    I see that Ext.data.TreeStore is in the api so why am I getting this error?
    I use to include sencha-touch-all.js and I do not see this file so I am now using sencha-touch.js

    Thanks in advance for your assistance.

  2. You just forgot to extend Ext.data.Model in your ListItem class - should look like this:

    Code:
    Ext.define('ListItem', {
        extend: 'Ext.data.Model',
        
        config: {
            fields: [
                       {name: 'name',     type: 'string'},
                       {name: 'avatar',   type: 'string'},
                       {name: 'sex',      type: 'string'},
                       {name: 'age',      type: 'string'},
                       {name: 'goodkids', type: 'string'},
                       {name: 'gooddogs', type: 'string'},
                       {name: 'goodcats', type: 'string'},
                       {name: 'house',    type: 'string'},
                       {name: 'crate',    type: 'string'},
                       {name: 'weight',   type: 'string'},
                       {name: 'ns',       type: 'string'},
                       {name: 'desc',     type: 'string'},
                       {name: 'leaf',     type: 'type'}
            ]
        }
    });
    Note also that I moved the fields config into the config object, otherwise you'll get a console warning

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,541
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You need to require that file in order to use it if you are going to use Ext.Loader

    Code:
    Ext.require([
        'Ext.data.TreeStore'
    ]);
    Or you can use a wildcard:

    Code:
    Ext.require([
        'Ext.data.*'
    ]);
    And that will load all the files in the Ext.data namespace
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Oct 2007
    Posts
    40
    Vote Rating
    0
    Answers
    1
    bsklar is on a distinguished road

      0  

    Default


    Still having issues.
    I now have:

    Code:
    Ext.require(['Ext.MessageBox', 'Ext.data.*', 'Ext.event.*', ]);
    And now I have get this error:
    Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class: Ext.MessageBox.

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,541
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You should be using sencha-touch-debug.js

    Ext.Loader should be enabled by default in that file, if not then you can do this:

    Code:
    Ext.Loader.setConfig({
        enabled : true
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Oct 2007
    Posts
    40
    Vote Rating
    0
    Answers
    1
    bsklar is on a distinguished road

      0  

    Default


    Getting closer, I hope.
    I now have:
    [ERROR][Ext.data.Store#setModel] Model with name undefined doesnt exist.

    and it is referring to the following:
    Code:
    var data = {
         text: 'Dogs',
         items: [
    		 
                    {name: 'Berlin', avatar: 'vgsr_images/Berlin.jpg', sex: 'Male', age:'8 Years Old', weight: '71.5 lbs.', goodkids: 'Yes', gooddogs: 'Yes', 
    				goodcats: 'Yes', 
    				house: 'Yes', crate: 'No',  ns: 'Yes',
    				desc: '<p style="width:90%">Berlin is an 8yo neutered male German Shepherd with a gorgeous white coat dropped off at a shelter by his family that had to move. </p>', leaf: true}
    	 ]
     };
    
    
     Ext.define('ListItem', {
         fields: [
                    {name: 'name',     type: 'string'},
                    {name: 'avatar',   type: 'string'},
                    {name: 'sex',      type: 'string'},
                    {name: 'age',      type: 'string'},
                    {name: 'goodkids', type: 'string'},
                    {name: 'gooddogs', type: 'string'},
                    {name: 'goodcats', type: 'string'},
                    {name: 'house',    type: 'string'},
                    {name: 'crate',    type: 'string'},
                    {name: 'weight',   type: 'string'},
                    {name: 'ns',       type: 'string'},
                    {name: 'desc',     type: 'string'},
                    {name: 'leaf',     type: 'type'}
         ]
     });
    
    
     var store = new Ext.data.TreeStore({
         model: 'ListItem',
         defaultRootProperty: 'items',
         root: data					// the list 
     });

  7. #6
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    Answers
    29
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    You just forgot to extend Ext.data.Model in your ListItem class - should look like this:

    Code:
    Ext.define('ListItem', {
        extend: 'Ext.data.Model',
        
        config: {
            fields: [
                       {name: 'name',     type: 'string'},
                       {name: 'avatar',   type: 'string'},
                       {name: 'sex',      type: 'string'},
                       {name: 'age',      type: 'string'},
                       {name: 'goodkids', type: 'string'},
                       {name: 'gooddogs', type: 'string'},
                       {name: 'goodcats', type: 'string'},
                       {name: 'house',    type: 'string'},
                       {name: 'crate',    type: 'string'},
                       {name: 'weight',   type: 'string'},
                       {name: 'ns',       type: 'string'},
                       {name: 'desc',     type: 'string'},
                       {name: 'leaf',     type: 'type'}
            ]
        }
    });
    Note also that I moved the fields config into the config object, otherwise you'll get a console warning
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  8. #7
    Sencha User
    Join Date
    Oct 2007
    Posts
    40
    Vote Rating
    0
    Answers
    1
    bsklar is on a distinguished road

      0  

    Cool Solved

    Solved


    Ed, thanks it now works.
    Sencha Touch is awesome, I volunteer for animal rescue groups and I used it to produce this website that everyone loves: http://www.vgsr.org and helps us in our mission. I greatly appreciate all the hard work
    and dedication that the team puts into it.

  9. #8
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    Answers
    29
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    I checked out the app, looking good! I have a few suggestions on how you can make your app code easier to maintain, would you mind if I use your app as an example in a blog post? In return I'll give you the full app adhering to best practices, and the community will have a nice example app to learn from.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  10. #9
    Sencha User
    Join Date
    Oct 2007
    Posts
    40
    Vote Rating
    0
    Answers
    1
    bsklar is on a distinguished road

      0  

    Cool


    Ed,

    That would be fantastic, I would not mind at all. I know it needs to change to MVC format, I've just been nervous about attempting it. Myself, our group, and the dogs, thank you for any assistance you can provide us with. I will be placing this code at GitHub with an open source license and I hope it will benefit other rescue groups. Let me know if you need anything from me to develop the example.

    Bruce

Thread Participants: 2