-
15 Nov 2012 4:04 AM #1
Answered: fill Form from store
Answered: fill Form from store
Hi, my goal is to fill my form field from a store loading in an MVC application, here is my code from
my controller:
the store loading is ok, app.model.Item is defined and gives no error, but the form still remain empty.PHP Code:var myStore = Ext.getStore('myStore');
myStore.getProxy().setExtraParams({id_item: '11'});
myStore.load({
callback: function(records, operation, success) {
if (success == true) {
var myModel = Ext.create('app.model.Item', {});
myModel.setData(records); // this is the problem
var selmodview = this.getSelmodview();
Ext.Viewport.animateActiveItem(selmodview, {type: 'slide', direction: 'left'});
var mainform = this.getMainform(); // this is the form to fill with records
mainform.setRecord(myModel);
} else {
console.log(operation.error.statusText);
}
},
scope: this
});
-
Best Answer Posted by sword-it
Hi wakatanka,
Try getAt(0) method of store class to get the model instances instead of creating model instance.
http://docs.sencha.com/touch/2-1/#!/...e-method-getAt
-
15 Nov 2012 4:34 AM #2Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 76
- Answers
- 124
use "getAt(0)" method of store class
use "getAt(0)" method of store class
Hi wakatanka,
Try getAt(0) method of store class to get the model instances instead of creating model instance.
http://docs.sencha.com/touch/2-1/#!/...e-method-getAtsword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
15 Nov 2012 4:56 AM #3
Thanks
Thanks
Thank you so much, you make my day.


Reply With Quote