admin管理员组文章数量:1325236
I got a extjs 4 bobox within a form bound to a model. I am binding data from grid to bo using form.loadRecord(record). The bobox is showing the valueField ing from the model assigned to the form instead of the displayField. The store of the bobox is preloaded. How can I achieve that the bobox shows the displayValue loading a record in the form?
{xtype:'bobox',
fieldLabel: 'category',
name: 'categorySelId',
store: 'Categories',
queryMode: 'local',
displayField: 'label',
valueField: 'id',
anchor:'96%',
loadMask: true,
typeAhead: true,
forceselection: true,
valueNotFoundText: 'Nothing found'}
The store is already used in the grid to show the column category
{ header: 'Category', dataIndex: 'categorySelectedId', flex:5,
renderer: function(value,metaData,record) {
if(value) {
var Categories = Ext.getStore('Categories');
var catRecord = Categories.findRecord('id', value);
return catRecord ? catRecord.get('label'): record.get('categorySelected');
} else return "";
}
},
Thx for your help!
I got a extjs 4 bobox within a form bound to a model. I am binding data from grid to bo using form.loadRecord(record). The bobox is showing the valueField ing from the model assigned to the form instead of the displayField. The store of the bobox is preloaded. How can I achieve that the bobox shows the displayValue loading a record in the form?
{xtype:'bobox',
fieldLabel: 'category',
name: 'categorySelId',
store: 'Categories',
queryMode: 'local',
displayField: 'label',
valueField: 'id',
anchor:'96%',
loadMask: true,
typeAhead: true,
forceselection: true,
valueNotFoundText: 'Nothing found'}
The store is already used in the grid to show the column category
{ header: 'Category', dataIndex: 'categorySelectedId', flex:5,
renderer: function(value,metaData,record) {
if(value) {
var Categories = Ext.getStore('Categories');
var catRecord = Categories.findRecord('id', value);
return catRecord ? catRecord.get('label'): record.get('categorySelected');
} else return "";
}
},
Thx for your help!
Share Improve this question edited May 2, 2012 at 1:16 Manuel asked May 1, 2012 at 21:21 ManuelManuel 9,55215 gold badges75 silver badges118 bronze badges 5- Are you sure the store is loaded before you load the record to the bobox? – sha Commented May 2, 2012 at 0:52
- Yes, I'm sure. I'm using it already in the grid column renderer to show the category label. See source edited post – Manuel Commented May 2, 2012 at 1:15
- That doesn't prove anything actually. What is the relationship between your grid and a form with bo? – sha Commented May 2, 2012 at 2:08
- grid on douple click handler: ... var selection = this.getArticleList().getSelectionModel().getSelection()[0]; theForm.loadRecord(selection); ... – Manuel Commented May 2, 2012 at 12:46
- let us continue this discussion in chat – sha Commented May 2, 2012 at 12:50
1 Answer
Reset to default 5The problem was that I have not had configured the correct types in the model. Setting the right type in the model solved the problem. Thx sha for helping!
本文标签: javascriptExtJS 4 combobox shows valueField instead of displayField on form bindStack Overflow
版权声明:本文标题:javascript - ExtJS 4 combobox shows valueField instead of displayField on form bind - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742169199a2426399.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论