为什么无法在文本字段中显示数据? [英] Why can not display datas in textfield?
本文介绍了为什么无法在文本字段中显示数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么屏幕上没有显示数据? 或者告诉我修复或避免此问题的正确方法。
谢谢。
[在视图块中]
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'
}]
}]
}
})
[在控制器块中]
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' }]);
}
推荐答案
如下访问文本字段:-
控制器-
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);
}
这篇关于为什么无法在文本字段中显示数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文