Results 1 to 3 of 3

Thread: JsonStore Problems

  1. #1

    Default JsonStore Problems

    I'd be grateful for help with this. I've been looking at it for hours. I've taken over an app written in Ext 2 and I'm not very familiar with it yet.

    I make a JsonStore in my application like this...

    Code:
           
     this.myStore = new Ext.data.JsonStore({
                url: this.application.gateway,
                root:  'details',
                autoLoad: true,        
                baseParams: {
                    module: 'details',
                    action: 'getDetails'
                },
                storeId: 'id',
                fields: [
                     {name:'languageID'  }, 
                     {name:'days' }
                ]            
            });
    So far, so good. If I log it in console
    Code:
    console.log( this.myStore );
    It looks much as expected.

    But if I try to access data:
    Code:
    console.log( this.myStore.data.items );
    console.log( this.myStore.getAt(0) );
    I get "[]" and undefined respectively.

    The JSON is very simple at the moment...

    Code:
    {"details":[{"languageID":"1","days":"4"}]}
    Thanks for any help,

    Pete

  2. #2

    Default

    Sorry if this is the wrong forum.

  3. #3

    Default

    Time!

    It's because it loads by AJAX.

    Thanks anyway. I reckon I know what to do now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •