Results 1 to 2 of 2

Thread: problem with store in a grid

  1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    1

    Default problem with store in a grid

    Hi all,

    I have a problem to create a grid in extjs 4.1.3
    If I use the following code there is an "store is undefined" error on extjs-all-debug.js line 100539

    PHP Code:
    Ext.define'MyApp.Model.Request', {
        
    extend'Ext.data.Model',
        
    fields: [
            {
    "name":"id","type":"int"},
            {
    "name":"type","type":"string"}
        ],
        
    idProperty'id'
    });
    Ext.define('MyApp.Store.RequestData', {
        
    extend:    'Ext.data.Store',
        
    model'MyApp.Model.Request',
        
    data : [
            {
    id1type'Spencer'},
            {
    id2type'Maintz'},
            {
    id3type'Conran'},
            {
    id4type'Avins'}
        ]
    });
    Ext.define('MyApp.View.RequestList' ,{
        
    extend'Ext.grid.Panel',
        
    store'MyApp.Store.RequestData',
        
    width200,
        
    columns: [
            {
    "text":"ID","width":100,"dataIndex":"id"},
            {
    "text":"Type","width":100,"dataIndex":"type"}
        ]
    });
    Ext.define('MyApp.Controller.RequestHandler', {
        
    extend'Ext.app.Controller',
        
    models: ['MyApp.Model.Request'],
        
    stores: ['MyApp.Store.RequestData'],
        
    init: function() {
            
    //console.log('Initialized Users! This happens before the Application launch function is called');
        
    },
        list: function( 
    renderTo ) {
            var 
    grid this.getView('MyApp.View.RequestList').create({
                
    renderTorenderTo
            
    });
            
    grid.focus();
        }
    });
    Ext.application({
        
    name'MyApp',
        
    appFolder'MyApp',
        
    controllers: [
            
    'MyApp.Controller.RequestHandler'
        
    ],
        
    requires  : [
            
    'MyApp.Controller.RequestHandler'
        
    ],
        
    launch: function() {
            var 
    controller this.getController'MyApp.Controller.RequestHandler' );
            
    controller.list( '93b67ba52a348fc648c81240636f6dd9' );
        }
    }); 
    I tested extjs version 4.1.1, but in this version the code works perfectly. http://jsfiddle.net/Hvevq/
    Futher I tested version 4.2 RC it works too.

    What is the failure in 4.1.3 ?

    Thx for helping

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    It will go to the StoreManager and try to get an instance of it based on the storeId given to the store. The controller/application will use RequestData as the storeId for that store not MyApp.store.RequestData
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Posting Permissions

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