سؤال

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!

هل كانت مفيدة؟

المحلول

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?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top