Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: JSon Data not loaded into store data

  1. #11
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,336
    Answers
    3885
    Vote Rating
    1297
      0  

    Default

    Glad you are finding that example useful. We provide examples in the download zip but the apps using MVC aren't simple enough to get people started. I'm hoping to get this as an included example but wanted to get it into people's hands right away.

    So you DataLoaded method in your controller is fired correctly but the code within it is erroring out? What line? You need to have the 3rd parameter of the on() call be the scope of that method set to the controller.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

  2. #12
    Sencha User
    Join Date
    Sep 2011
    Posts
    22
    Vote Rating
    0
      0  

    Default

    When I set the 3rd parameter to 'this' on the on() then the error I provided in my earlier post is generated and the DataLoaded method is not called. If i do not provide the 3rd parameter the DataLoaded method is called but then the scope of 'this' is the store.

  3. #13
    Sencha User
    Join Date
    Sep 2011
    Posts
    22
    Vote Rating
    0
      0  

    Default

    The line that the code is failing is highlighted below and the following error is generated.

    Uncaught Error: [ERROR][RDPMobile.controller.WorkOrders.Monitor#getObservableId] Invalid unique id of 'WorkOrders.Monitor' for this object

    The controller I am doing all this in is called WorkOrders.Monitor. By passing the 3rd parameter it appears the system is interpreting the passed in reference as a duplicate reference to this controller. Is this a bug?

    Code:
       ShowEditForm: function(recordID) {
    
            var store   = Ext.create('RDPMobile.store.WorkOrders.WorkOrder');
    
    
            store.on('load',this.DataLoaded, this);
    
    
            store.load({ params: {WorkOrderID: recordID}});
        }

  4. #14
    Sencha User
    Join Date
    Sep 2011
    Posts
    22
    Vote Rating
    0
      0  

    Default

    I seemed to have figured out a solution. I have changed the code to read like this:

    Code:
        ShowEditForm: function(recordID) {
            var viewport   = this.getViewport(),
                store   = Ext.create('RDPMobile.store.WorkOrders.WorkOrder');
    
    
            store.on('load',this.DataLoaded, viewport);
    
    
            store.load({ params: {WorkOrderID: recordID}});
        }
    Code:
        DataLoaded: function(store) {
            var topToolbar = this.down('titlebar[docked=top]'),
                newCard    = this.add({xtype: 'rdpmobile-woaddchange'});
    
    
            newCard.setRecord(store.getAt(0));
    
    
            this.setActiveItem(newCard);
    
    
            topToolbar.setTitle('Change Work Order');
    
    
        },
    This avoids the error I was getting using 'this' as the 3rd parameter.

    Thanks for all your help.
    Ron

Page 2 of 2 FirstFirst 12

Posting Permissions

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