-
Sencha User
var nul when SetValue
Hello,
I develop a mobile app using sencha touch 2. I have a model that map a rest url. In my controller when I create the model and after I setValue from the component the variable is null even in the console log has values.
WHat I made wrong?
===model===
Ext.define("IBMobile.model.AccountDetails", {
extend : "Ext.data.Model",
config : {
idProperty : 'accountId',
fields : [{
name : 'accountId',
type : 'int'
}, {
name : 'alias',
type : 'string'
}
],
validations : [{
type : 'presence',
field : 'accountId'
}],
proxy : {
type : 'rest',
url : 'rest/account/details',
listeners : {
exception : function(proxy, response, operation) {
Ext.Msg.alert(Ux.locale.Manager
.get('payments.validationMsg.err'),
response.responseText);
}}}}
});
===controller function===
viewAccountDetails : function(list, record) {
var accountDetails = Ext
.create("IBMobile.view.Accounts.AccountDetails");
this.getMainNavigation().push(accountDetails);
console.dir(record);
var accDetails = Ext.create('IBMobile.model.AccountDetails', {
accountId : record.data.accountId
});
accDetails.save();
console.log('====');
console.log(accDetails);
Ext.getCmp('alias').setValue('Alias'+accDetails.get('accountId') + accDetails.get('alias'));
},
===
The accDetails variable in console log has all the propeties set inclusive alias but when I set value for the component alias it is null. How it's posible?
-
Sencha User
i've solved .
var accountDetailsModel = Ext.ModelMgr.getModel('AccDetails');
accountDetailsModel.load(record.data.accountId, {
success: function(accDetails) {
Ext.getCmp('accountType').setValue(accDetails.data.groupName);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules