-
7 Sep 2010 4:09 PM #1
HELP: grid combo on blur set valueField
HELP: grid combo on blur set valueField
Hi,
Using: Ext 3.2.1
I have a grid combo editor that load remote JSON data. All works fine except after selection of combo is displays the id field.
1. Combo loads fine
--------------------------------------
combo1.jpg
2. Make selection
--------------------------------------
combo2.jpg
3. onBlur the displayField is gone and replace with valueField
--------------------------------------
combo3.jpg
Here is my code:
What am I doing wrong?PHP Code:var myCombo = new Ext.form.ComboBox({
fieldLabel : 'myComboBox'
,hiddenName : 'combo_id'
,valueField : 'id'
,displayField : 'descr'
,forceSelection : true
,triggerAction : 'all'
,mode : 'remote'
,store : new Ext.data.JsonStore({
id : 'id'
,root : 'rows'
,fields : [
{name:'id', type:'int'}
,{name:'descr', type:'string'}
]
,url : 'combo.php'
})
});
var grid = new Ext.grid.EditorGridPanel({
...
,columns: [
...
{header: 'Combo Name' ,editor: myCombo, dataIndex: 'combo_descr'}
...
]
..
});
-
8 Sep 2010 12:06 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
You not only need a column editor, you also need a column renderer that displays the description for an id.
-
8 Sep 2010 2:53 AM #3
like this?
like this?
Thanks for the hint Condor. I found this blog post that may be what im looking for (not at work atm, so can't test it), but is this what you mean? Do you of any other documentation/examples that explains this concept?
http://www.fusioncube.net/index.php/...t-for-datagrid
PHP Code:function CodeRenderer(val){
var matching = ItemCodesStore.queryBy(
function(rec,id){
return rec.item_id == val;
});
return (matching.items[0]) ? matching.items[0].data.item_code : '';
};
// Snippet from ColumnModel of DataGrid
header: 'Code',
dataIndex: 'existingCode',
width: 70,
renderer: CodeRenderer,
editor: new Ext.form.ComboBox({
mode: 'local',
displayField: 'item_code',
valueField: 'item_id',
store: ItemCodesStore
})
-
8 Sep 2010 2:56 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Similar Threads
-
combobox set displayField valueField
By sofway in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 30 Mar 2010, 9:41 PM -
How to set a combobox valueField to a different value other than the displayField?
By darren in forum Ext 3.x: Help & DiscussionReplies: 12Last Post: 16 Feb 2010, 12:51 AM -
Blur combo box at the end of onSelect function
By pieter333 in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 27 Feb 2009, 10:29 AM -
[Ext 2.0] Combo and Blur
By sfwalter in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 30 Sep 2007, 1:14 PM


Reply With Quote