Results 1 to 3 of 3

Thread: Ext.create on store returning error

  1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    Brazil - MG, Belo Horizonte
    Posts
    62
    Answers
    4

    Default Answered: Ext.create on store returning error

    Hello guys, i'm needing to use Ext.create at one store defined on the system...
    The problem it's because when i try to do it, firefox and crhome return errors:

    Crhome:
    c is not a constructor
    ...instantiators[length] = new Function('c', 'a', 'return new c('+args.join(',')+'...

    Firefox:
    Uncaught TypeError: object is not a function


    Well, i have any idea why it is happening...
    Here it's defined codes, creation and etc...


    Code:
    Ext.define('gconnect.view.Financeiro.Lancamento.Sidebar', {    extend: 'Ext.grid.Panel',
        id:'SidebarLancamento',
        alias: 'widget.SidebarLancamento',
        store: Ext.create('gconnect.store.Financeiro.ListaContas.ListaContas'),
    
    
        layout:'fit',
        border:false,
        features: [
            Ext.create('Ext.grid.feature.Grouping', {
                groupHeaderTpl: '{name} ({rows.length})',
                startCollapsed: true
            })
        ],
        columns:[
            {header: 'Conta',  dataIndex: 'nome',  flex: 1},
            {header: 'Saldo Atual',  dataIndex: 'saldoatual',  flex: 1}
        ]
    });
    My problem it's with this line:
    PHP Code:
    Ext.create('gconnect.store.Financeiro.ListaContas.ListaContas'

    My store definition:
    Code:
    Ext.define('gconnect.store.Financeiro.ListaContas.ListaContas', {    extend: 'Ext.helper.Abstract.DefaultStore',
        model: 'gconnect.model.Financeiro.ListaContas.ListaContas',
    
    
        idProperty: 'codlistaconta',
        urlRead: baseurl+'financeiro/lista_contas/listar',
        urlSave: baseurl+'financeiro/lista_contas/salvar',
        urlDelete: baseurl+'financeiro/lista_contas/deletar'
    });
    My Extended store:
    Code:
    Ext.define('Ext.helper.Abstract.DefaultStore', {
        extend: 'Ext.data.Store',
        //autoLoad: true,
        autoSync: true,
        pageSize: 20,
        
        idProperty: undefined,
        urlRead: undefined,
        urlSave: undefined,
        urlDelete: undefined,
        
        constructor: function(options){
    	Ext.apply(this,options || {});
            
            this.proxy = {
                method: 'POST',
                type: 'ajax',
                url: this.urlRead,
                actionMethods: { read: 'POST' },
                reader: {
                    idProperty: this.idProperty,
                    type: 'json',
                    root: 'data',
                    totalProperty: 'total',
                    successProperty: 'success'
                }
            }
    
    
            this.callParent(arguments);
        }
    })

  2. I normally see that error when I forget to include a class within my controller. Have you added the store and model to your controller?

    Also, I'm not sure that you can use Ext.create within your definition if it's not called from within another method (e.g. initComponent() )

    You may need to try as follows:

    PHP Code:
    initComponent: function() {

      var 
    store Ext.create('gconnect.store.Financeiro.ListaContas.ListaContas');

      
    Ext.apply(this, {
        
    storestore
      
    });

    this.callParent(arguments);



  3. #2
    Sencha User
    Join Date
    Oct 2010
    Location
    France
    Posts
    37
    Answers
    2

    Default

    I normally see that error when I forget to include a class within my controller. Have you added the store and model to your controller?

    Also, I'm not sure that you can use Ext.create within your definition if it's not called from within another method (e.g. initComponent() )

    You may need to try as follows:

    PHP Code:
    initComponent: function() {

      var 
    store Ext.create('gconnect.store.Financeiro.ListaContas.ListaContas');

      
    Ext.apply(this, {
        
    storestore
      
    });

    this.callParent(arguments);



  4. #3
    Sencha User
    Join Date
    Oct 2010
    Location
    Brazil - MG, Belo Horizonte
    Posts
    62
    Answers
    4

    Default

    Quote Originally Posted by ero View Post
    I normally see that error when I forget to include a class within my controller. Have you added the store and model to your controller?

    Also, I'm not sure that you can use Ext.create within your definition if it's not called from within another method (e.g. initComponent() )

    You may need to try as follows:

    PHP Code:
    initComponent: function() {

      var 
    store Ext.create('gconnect.store.Financeiro.ListaContas.ListaContas');

      
    Ext.apply(this, {
        
    storestore
      
    });

    this.callParent(arguments);


    It's funny that i didn't thougth this... I use the initComponent on every place on the system, and didn't tryed to set the store with he... As you said, i can't assign directly
    Ext.create('gconnect.store.Financeiro.ListaContas.ListaContas');

    to the store, but as you posted, using the initComponent everything it's fine... Thanks by the help!!!

Posting Permissions

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