extjs - extjs 表单、组合和隐藏名称
问题描述
有这个代码。
Ext.define('App.v2.model.Things', {
extend: 'App.v2.model.Base'
,fields: [{
name: 'C'
,type:'int'
},{
name:'NAME'
,type:'string'
},{
name:'SHORT_NAME'
,type:'string'
}]
,proxy:{
url:'/data/data1.php'
,reader : {
rootProperty: 'data'
},
extraParams: {
limit: 1000
}
},
idProperty: 'C'
});
文件模型
Ext.define('App.v2.model.ThingsList', {
extend: 'App.v2.model.Base'
,fields: [{
name: 'C'
,type:'int'
},
{
name: 'THING_ID',
type:'int'
},
{
name: 'ZE',
type:'int'
},
{
name: 'HS',
type:'int'
},
{
name: 'THING_NAME',
type:'string'
},]
,proxy:{
url:'/data/thingsList.php'
,reader : {
rootProperty: 'data'
}
},
idProperty: 'C'
});
表单配置
items: [{
xtype: 'form',
bodyStyle: 'border:none',
defaultType: 'textfield',
layout: 'fit',
maindata: [{
xtype: 'panel',
//layout: 'vbox',
layout: 'vbox',
id: 'ThingsForm',
items: [{
xtype: 'textfield',
fieldLabel: 'ЗЕ',
name: 'ZE',
width: 400,
allowBlank: false
},
{
xtype: 'textfield',
fieldLabel: 'HS',
name: 'HS',
width: 400,
allowBlank: false
},
{
xtype: 'combo',
fieldLabel: 'Thing',
name: 'THING_ID',
hiddenName: 'THING_NAME',
valueField: 'C',
displayField: 'SHORT_NAME',
store : {
model:'App.v2.model.Things',
autoLoad: true,
}
}
//]
]
}]
}]
加载数据以形成
row = grid.store.getAt(this.conf.grid.getSelectionModel().getCurrentPosition().rowIdx);
form = this.down('form').getForm();
form.loadRecord(row);
都好。表格显示值
更改表格后尝试更新记录
var record = form.getRecord(); // see old values of THING_ID and THING_NAME
record.set(form.getValues()); // see new value of THING_ID and OLD value of THING_NAME
如何更新THING_NAME
到已NEW value (TEXT)
选中COMBO
的记录?
只喜欢描述那里? ExtJS 5 组合框 - 提交值和文本
解决方案
推荐阅读
- java - 将自己的应用程序添加到 whatsapp 音频选择
- r - 如何在注释函数中使用表达式 enquo()
- python - python浮动到没有点的指数中的字符串
- ruby-on-rails - 将www url重定向到rails中的非www url
- xml - 使用 XPath 从 Postgres XML 列中提取数据
- symfony - 升级到 symfony 3.4 后访问 js 和 css
- php - 在 Bitnami WAPP Postgresql 上运行 laravel
- sed - 使用 sed,在每行的倒数第三个索引处插入一个空格
- sql - 有没有一种方法可以将 Django ORM 查询集转换为原始 SQL 以包含 select_related 和 prefetch_related?
- git - 整个 git 分支的简单变基以正确的方式