1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    fullbl is on a distinguished road

      0  

    Default Answered: Combobox not loading from created store (MVC)

    Answered: Combobox not loading from created store (MVC)


    Hello, I'm developing an application using MVC model.

    I have a store called "Rivenditori", linked to a grid. It gets data from a json call to a PHP page and the data are displayed fine.

    Inside another grid, I try to create a combobox for letting users choose the "Rivenditori" linked to a row, but I can't populate it using this code:

    Code:
    editor: {				typeAhead: true,
    				xtype: 'combo',
    				queryMode: 'local',
    				store: Ext.getStore('tabella.Rivenditori'),
    				displayField: 'nome',
    				valueField: 'id_azienda'				
    			}
    or
    Code:
    ...
    store: 'rivenditori',		 //storeId
    ...
    But just creating a new store:

    Code:
    ...
    store: Ext.create('My.store.tabella.Rivenditori'),		
    ...
    I'm sure there should be a way to get the store without creating a new one, but it doesn't work for me, neither with getStore, nor with the storeId... And I don't have any variable with the store, since I'm just putting them in the controller!

    Any suggestion? Am I doing something wrong?

  2. I've found a solution by myself:
    in the controller (remember to put the needed store in stores):

    Code:
    this.control({
                'combo' : {
                    beforerender: function (ogg, eOpts) { 
                        ogg.bindStore (Ext.getStore(ogg.store));
                    }
                },

    PS: Sorry, but I don't know how to mark the post as answered!

  3. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,663
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    Ext.getStore() expects the storeId as a parameter, not the class name.

    I would use the console and try to test the store getting code there to see if it works.
    It could also be a timing issue: make sure that the store instance is created when creating the combobox.
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  4. #3
    Sencha User
    Join Date
    Aug 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    fullbl is on a distinguished road

      0  

    Default


    Many thanks for the reply!

    However:
    Quote Originally Posted by tobiu View Post
    Ext.getStore() expects the storeId as a parameter, not the class name.
    That's strange, I've used it in the controller with the class name and it works... Maybe because:
    Quote Originally Posted by docs
    Note that when store is instatiated by Controller, the storeId will be overridden by the name of the store.
    In any case, I've tryed to put storeId: 'rivenditori' on the store and store: Ext.getStore('rivenditori') (I also tried store: 'rivenditori'), but all I get is still just an empty combobox... And I'm sure the store is created, because it populates another grid!

    Any help?

  5. #4
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,345
    Answers
    499
    Vote Rating
    250
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      1  

    Default


    If you have a store called My.store.tabella.Rivenditori and create an instance from a controller it'll have the id tabella.Rivenditori, any attempt to set a different storeId will be ignored. My guess would be that you're calling getStore before the store is instantiated.

    You could try something a bit lazier like this:

    Code:
    store: 'tabella.Rivenditori',
    Sharing a store with a combobox won't work correctly though as the filtering will affect all the views that share the store.

  6. #5
    Sencha User
    Join Date
    Aug 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    fullbl is on a distinguished road

      0  

    Default


    Uncaught TypeError: Cannot call method 'on' of undefined
    is the error I get if I try with
    Code:
    store: 'tabella.Rivenditori'
    In this way the combobox isn't even instantiated... It's like the store doesn't exist (it's the same error I can get if I write store: 'asdasfsgfgtrv'....)

    I think the only real method is to use Ext.create everytime...

  7. #6
    Sencha User
    Join Date
    Aug 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    fullbl is on a distinguished road

      0  

    Default


    I've found a solution by myself:
    in the controller (remember to put the needed store in stores):

    Code:
    this.control({
                'combo' : {
                    beforerender: function (ogg, eOpts) { 
                        ogg.bindStore (Ext.getStore(ogg.store));
                    }
                },

    PS: Sorry, but I don't know how to mark the post as answered!

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar