-
28 Dec 2011 9:34 AM #11Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
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 @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
28 Dec 2011 10:34 AM #12
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.
-
28 Dec 2011 12:02 PM #13
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}}); }
-
28 Dec 2011 3:17 PM #14
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}}); }This avoids the error I was getting using 'this' as the 3rd parameter.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'); },
Thanks for all your help.
Ron


Reply With Quote