Domanda

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!

È stato utile?

Soluzione

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?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top