Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    13
    Vote Rating
    0
    twh is on a distinguished road

      0  

    Default [FIXED-254] JsonStore example broken in documentation

    [FIXED-254] JsonStore example broken in documentation


    I've simplified the JsonStore example in the documentation here:

    http://dev.sencha.com/deploy/ext/doc...JsonStore.html

    Code:
    Ext.setup({
        onReady: function() {
    
    	var store = new Ext.data.JsonStore({
    		// store configs
    		autoDestroy: true,
    		url: 'get-images.php',
    		storeId: 'myStore',
    		// reader configs
    		root: 'images',
    		idProperty: 'name',
    		fields: ['name', 'url', 'size', 'lastmod']
    	});
    
    	}
    });
    The only thing I changed was wrapping the creation of the store var in an Ext.setup() call and created a get-images.php file which returns a JSON object with name, url, size, and lastmod values. And yet when I load the page, I get this error:

    TypeError: Result of expression 'this.model' [undefined] is not an object.

    Is there something I'm missing, or is the example incomplete? It isn't clear what other code is necessary to create a store.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,657
    Vote Rating
    584
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    The code is incorrect in the class, but in a lot of way it's not needed anymore. One of the main reasons it existed is because in Ext there wasn't really a simple way to construct a store with just json, but now you can do:

    Code:
    new Ext.data.Store({
        fields: ['name', 'url', 'size', 'lastmod'],
        reader: {
            root: 'images'
            idProperty: 'name'
        },
        proxy: {
            url: 'get-images.php'
        }
    });
    Which isn't really much longer than what we already have.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,657
    Vote Rating
    584
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    The docs have been updated in 0.94 to reflect the correct usage.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Similar Threads

  1. [FIXED][2.2.x] allowContainerDrop is still broken
    By Deadmeat in forum Ext 2.x: Bugs
    Replies: 3
    Last Post: 4 May 2009, 2:47 PM
  2. Links to .js source files in the API Documentation are Broken
    By Gjslick in forum Community Discussion
    Replies: 3
    Last Post: 3 May 2009, 9:46 AM
  3. [FIXED][3.0] grouptabs example broken
    By amorworx in forum Ext 3.x: Bugs
    Replies: 6
    Last Post: 24 Apr 2009, 1:27 AM
  4. [FIXED][3.0] grouptabs example broken
    By amorworx in forum Ext 2.x: Bugs
    Replies: 5
    Last Post: 9 Apr 2009, 2:13 PM
  5. JsonStore + typeahead = broken?
    By alos in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 15 Dec 2007, 5:05 PM

Thread Participants: 1