1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    48
    Vote Rating
    0
    horcle_buzz is on a distinguished road

      0  

    Default Answered: Throwing in the towel

    Answered: Throwing in the towel


    Hours of frustration trying to load data into a table leads me here.

    My model:

    Code:
    Ext.define('EvaluateIt.model.Site', {
        extend: 'Ext.data.Model',
        
        config: {
            fields: [
                {name: 'id', type: 'int'},
                {name: 'remoteSiteId'}
         ]
             
            
        /*,
            hasMany: [{ model: 'EvaluateIt.model.Evaluation' }],
        hasMany: [{ model: 'EvaluateIt.model.SiteMaintainer' }],
         hasOne: [{ model: 'EvaluateIt.model.Address' }],
        hasOne: [{ model: 'EvaluateIt.model.Geolocation' }]
       */
        }
    });

    My store:
    Code:
    Ext.define('EvaluateIt.store.Sites', {
        extend: 'Ext.data.Store',
        requires: ['Ext.data.proxy.SQL','EvaluateIt.model.Site'],
        config:{
            model: 'EvaluateIt.model.Site',
        storeId: 'sites',
        proxy: {
               type: "sql",
               database: 'Test'
            },
            autoLoad: true
        }
    });
    My controller:

    Code:
    Ext.define('EvaluateIt.controller.Site', {
        extend: 'Ext.app.Controller',
        
        config: {
            refs: {
            store: 'EvaluateIt.store.Sites',
            autoCreate: true    
                
            },
            control: {
                
            }
        },
        
        //called when the Application is launched, remove if not needed
        launch: function(app) {
        var store = getStore('EvaluateIt.store.Sites');
        store.add([{remoteSiteId: '1'}]);
        store.sync();
            
        }
    });
    I am just trying to load data into my table as a simple first step in implementing my app conversion from JQM to Sencha Touch (latest and greatest everything as of today). However, I am getting an error that "Uncaught ReferenceError: getStore is not defined." I've read that I need to create the store before calling this method, which I have tried to no avail (am I not mistaken that autoCreate is supposed to do this for me?). The database and table are being created, but I am just not able to load data into them, regardless of all the things I have tried.

    Such a trivial thing should not be such a PITA! (^_^)

    Thanks in advance!

    Greg--

  2. The error message is telling you what's wrong. Maybe you meant to call Ext.getStore?

    Also, stores don't belong in the "refs" section of your controller.

  3. #2
    Sencha User
    Join Date
    Jun 2010
    Location
    France
    Posts
    44
    Answers
    2
    Vote Rating
    0
    ludm is on a distinguished road

      0  

    Default


    Have you tried to instantiate the store ?
    var myStore= Ext.create('EvaluateIt.store.Sites');

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    48
    Vote Rating
    0
    horcle_buzz is on a distinguished road

      0  

    Default Instantiation of store

    Instantiation of store


    Hi,
    Regarding your question, yes, I did, and I apologize for the incompleteness of my initial question (chalk that up to being tired after a long week!):

    I did so as,

    Code:
    var store = Ext.create('EvaluateIt.store.Sites');
    store.add([{remoteSiteId: '1'}]);
    store.sync();
    When I do this, then I get an error that "Uncaught TypeError: Cannot call method 'hasOwnProperty' of null"... what was a bit confusing, is if I still have to do a getStore even though the store should have been created.

    So, to test this, I tried grabbing the reference to the store using getStore,

    Code:
    var myStore = Ext.create('EvaluateIt.store.Sites'),
        store = getStore(myStore);
    store.add([{remoteSiteId: '1'}]);
    store.sync();
    Which threw the error "Uncaught ReferenceError: getStore is not defined"... thus, as you can see, I am fighting with the syntax. I definitely understand how this works (especially since I come from a Groovy/Grails background), I am just now fighting with the idiosyncrasies of how to instantiate and then manipulate my store object.

    Not meaning to complain, but while the documentation is very comprehensive, there are not a lot of really basic examples out there. Dealing with JQM/Backbone/Underscore/Lawnchair was so much easier than this, but hopefully this initial pain will make the effort worth it.

    Thanks very much!

    Greg--
    Last edited by horcle_buzz; 9 Feb 2013 at 8:19 AM. Reason: clarity

  5. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    411
    Answers
    5
    Vote Rating
    17
    jweber will become famous soon enough

      0  

    Default


    The error message is telling you what's wrong. Maybe you meant to call Ext.getStore?

    Also, stores don't belong in the "refs" section of your controller.

  6. #5
    Sencha User
    Join Date
    Feb 2013
    Posts
    48
    Vote Rating
    0
    horcle_buzz is on a distinguished road

      0  

    Default


    Quote Originally Posted by jweber View Post
    The error message is telling you what's wrong. Maybe you meant to call Ext.getStore?

    After examining the table, I realized the id attribute was not necessary since it gets created as a PK by default, so my model is now:

    Code:
    Ext.define('EvaluateIt.model.Site', {
        extend: 'Ext.data.Model',
        
        config: {
            fields: [
                {name: 'remoteSiteId'}
         ]
             
            
        /*,
        hasMany: [{ model: 'EvaluateIt.model.Evaluation' }],
        hasMany: [{ model: 'EvaluateIt.model.SiteMaintainer' }],
        hasOne: [{ model: 'EvaluateIt.model.Address' }],
        hasOne: [{ model: 'EvaluateIt.model.Geolocation' }]
       */
        }
    });
    And, my launch action now looks like this:

    Code:
    launch: function(app) {    var myStore = Ext.create('EvaluateIt.store.Sites'),
        store = Ext.getStore(myStore);
    
    
        store.add([{remoteSiteId: '1'}]);
            
        store.sync();
    }
    However, I get "Uncaught TypeError: Cannot call method 'hasOwnProperty' of null" again. So, table is being created, but no data are loaded when the sync method is called. I feel like I am running in circles here! (Just for yucks, I have queried the table through the SQLite Manager in Firefox, looking at the structure; tried inserting data, etc., etc.)


    Also, stores don't belong in the "refs" section of your controller.
    Alright, so that answers that question. Removed it from the refs...

    Looks like my new problem is a known issue. See http://www.sencha.com/forum/showthre...368#post937368 ... on to bigger and better things now.

    Danke Schoen!

    Greg--

  7. #6
    Sencha User
    Join Date
    Feb 2013
    Posts
    48
    Vote Rating
    0
    horcle_buzz is on a distinguished road

      0  

    Default


    Btw, all my replies seem to be disappearing. Is this a forum feature?

    Greg--

  8. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by horcle_buzz View Post
    Btw, all my replies seem to be disappearing. Is this a forum feature?

    Greg--
    After posting, you would have gotten a message that your post was marked for moderation. I have cleaned all your duplicated up for you.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  9. #8
    Sencha User
    Join Date
    Feb 2013
    Posts
    48
    Vote Rating
    0
    horcle_buzz is on a distinguished road

      0  

    Default


    Thanks for that! (However, when I went to edit some of my older posts in this thread, and then resubmit them, they turned pinkish and proceeded to disappear...)

    Greg--

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