The error message you're receiving indicates that the rec
variable is undefined. Are you sure that your store_usr
exists, and is loaded? If so, does store_usr.getAt(0)
return anything?
problems getting the value of a field in a Ext.data.Model
-
04-07-2023 - |
题
I need to set values in a text field, obtaining a data.Model these values, but when I run the function anywhere in the code, sends me this error:
Uncaught TypeError: Can not read property 'get' of undefined
But if I run it from a button works fine.
this is the code:
function SetterValues() {
var rec = store_usr.getAt(0);
Ext.getCmp('name_usr').setValue(rec.get("user"));
Ext.getCmp('nom_usr').setValue(rec.get("name"));
Ext.getCmp('ape_usr').setValue(rec.get("LastName"));
}
Help please! because I can not run it from anywhere in my code!
解决方案
不隶属于 StackOverflow