Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Location
    Bogota, Colombia
    Posts
    33
    Vote Rating
    0
    xyrer is on a distinguished road

      0  

    Question Answered: preferred way to make a store

    Answered: preferred way to make a store


    I have this model:

    Code:
    Ext.define('Article',{
    			extend: 'Ext.data.Model',
    			fields: [
    				{name:'Headline',type:'string'},
    				{name:'Summary',type:'string'},
    				{name:'Body',type:'string'},
    				{name:'Thumbs',type:'string',mapping:'Photos > Thumbnail'}
    			]
    		});
    And this two ways to declare a store, the first one throws an error saying I'm trying to define a store with no model, the second works ok but can't get to it on the safari debugger, what's the difference between the two and which one should I use?

    Code:
    Ext.define('Articles_store',{
    			extend: 'Ext.data.Store',
    			model: 'Article',
    			proxy: {
    				type: 'ajax',
    				url: 'http://localhost:8080/data.xml',
    				reader: {
    					type: 'xml',
    					root: 'channel',
    					record: 'item'
    				}
    			},
    			autoLoad: true
    		})
    		
    		var Articles_store = Ext.create('Ext.data.Store',{
    			model: 'Article',
    			proxy:{
    				type: 'ajax',
    				url: 'http://localhost:8080/data.xml',
    				reader: {
    					type: 'xml',
    					root: 'channel',
    					record: 'item'
    				}
    			},
    			autoLoad: true
    		});

  2. I would use Ext.Define to define my own store. I think all classes in ExtJs4 and ST2 are created this way. With the Ext.create I would instantiate the classes that I created.

    Check this post: http://www.sencha.com/forum/showthre...l=1#post595035

    What I would do regarding your snippets:
    1, Define my own namespace like MyApp:
    Code:
    Ext.define('MyApp.model.Article', {...});
    and the Store:
    Code:
    Ext.define('MyApp.store.Article' , {...});
    And the I would instantiate the store like this:
    Code:
    Ext.create('MyApp.store.Article');
    I hope you have read this: http://docs.sencha.com/touch/2-0/#!/guide/class_system

  3. #2
    Sencha User
    Join Date
    Sep 2010
    Location
    Netherlands
    Posts
    120
    Answers
    3
    Vote Rating
    4
    aacoro is on a distinguished road

      0  

    Default


    I would use Ext.Define to define my own store. I think all classes in ExtJs4 and ST2 are created this way. With the Ext.create I would instantiate the classes that I created.

    Check this post: http://www.sencha.com/forum/showthre...l=1#post595035

    What I would do regarding your snippets:
    1, Define my own namespace like MyApp:
    Code:
    Ext.define('MyApp.model.Article', {...});
    and the Store:
    Code:
    Ext.define('MyApp.store.Article' , {...});
    And the I would instantiate the store like this:
    Code:
    Ext.create('MyApp.store.Article');
    I hope you have read this: http://docs.sencha.com/touch/2-0/#!/guide/class_system
    Last edited by aacoro; 11 Dec 2011 at 3:07 AM. Reason: typos

  4. #3
    Sencha User
    Join Date
    Dec 2011
    Location
    Bogota, Colombia
    Posts
    33
    Vote Rating
    0
    xyrer is on a distinguished road

      0  

    Default


    I see now, coming from sencha 1.1 I didn't have such a solid idea of using classes, any Idea of how would I be able to see the instantiated store on the safari debugger or firebug?

  5. #4
    Sencha User
    Join Date
    Sep 2010
    Location
    Netherlands
    Posts
    120
    Answers
    3
    Vote Rating
    4
    aacoro is on a distinguished road

      0  

    Default


    Quote Originally Posted by xyrer View Post
    I see now, coming from sencha 1.1 I didn't have such a solid idea of using classes, any Idea of how would I be able to see the instantiated store on the safari debugger or firebug?
    I haven't found a good debugging way other that logging the things I'm interested in:
    Code:
    var myInstantiatedClass = Ext.create.....
    
    console.log(myInstantiatedClass)
    btw: i do this in Chrome, with the developer tools

  6. #5
    Sencha User
    Join Date
    Dec 2011
    Location
    Bogota, Colombia
    Posts
    33
    Vote Rating
    0
    xyrer is on a distinguished road

      0  

    Default


    Yeah, I used to be able to add the stores to the "watch expression" list but I can't do it now in 2.0, I need it that way because I wanted to see it after it's loaded but I have to do some workarounds to get the info I need, I will keep looking anyway. thanks.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi