Why can not display datas in textfield?

你离开我真会死。 提交于 2019-12-12 02:01:00

问题


Why no data is displayed on the screen? Or tell me a good/correct way to fix or avoid this.

Thank you.

[in view block]

Ext.define('CreditQuery.view.QueryResult', {
extend: 'Ext.tab.Panel',
xtype: 'queryresult',

config: {
    defaults: {
        defaultType: 'textfield'
    },
    items: [{
        title: 'Credit',
        },
        items: [{
            label: 'CustNo',
            name: 'ACCOUNT_ID'
        },{
            label: 'CustName',
            name: 'ACCOUNT_TEXT'
        }]
    }]
}
})

[in controller block]

function setData(data){
data = {
    ACCOUNT_ID: "FN2180004",
    ACCOUNT_TEXT: "John1218"
}

Ext.ComponentQuery.query('queryresult textfield')[0].setValue(data.ACCOUNT_ID);
Ext.ComponentQuery.query('queryresult textfield')[1].setValue(data.ACCOUNT_TEXT);

Ext.ComponentQuery.query('main')[0].push([{ xtype: 'queryresult' }]);
}

回答1:


Access the textfields like this: -

Controller-

refs: {
    customerNumberField : 'textfield[name="ACCOUNT_ID"]',
    customerNameField : 'textfield[name="ACCOUNT_TEXT"]'
}

function setData(data){
 data = {
    ACCOUNT_ID: "FN2180004",
    ACCOUNT_TEXT: "John1218"
 }

 this.getCustomerNumberField().setValue(data.ACCOUNT_ID);
 this.getCustomerNameField().setValue(data.ACCOUNT_TEXT);
}


来源:https://stackoverflow.com/questions/24017662/why-can-not-display-datas-in-textfield

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!