Question

i have a lot of textfields for userdata. and i wish to set it from DB.

items: [{
                        xtype: "form",
                        bodyPadding: 5,
                        border: false,
                        defaults: {
                            xtype: "textfield",
                            inputType: "text",
                            anchor: "100%"
                        },
                        items: [{
                            fieldLabel: 'Username:',
                            readOnly: true,
                            value: 'Admin',
                            name: "username"
                        }, {

i have external class named openDB.js with method getUserByUsername() here is small code how its will be used in other view and it works, but in my actuall view i cant set the Value of textfield. please help how to do that?

 openDB.getUserByUsername(user.username).then(function(userDetails) {
            me.setTitle("Welcome " + userDetails.mail + "!");
        });

i want to do something like this with value: 'Admin' and so on...

i found some method on Sencha Forum, but can I use it??

setValue: function(value) {
        var me = this;
        me.setRawValue(me.valueToRaw(value));
        return me.mixins.field.setValue.call(me, value);
    },
Was it helpful?

Solution

after couple hours of fighting with that -> BEST SOLUTION EVER:

items: [{
                        fieldLabel: 'Username:',
                        id: 'usernameID',
                        readOnly: true,
                        value: user.username,
                        name: "username"
}]
... 
var name = Ext.getCmp('usernameID').setValue('JohnRambo');

OTHER TIPS

Why not just set up a model and store for your form and use the loadRecord method?

It works for me:

ELEMENT.inputEl.dom.value = "000000";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top