PDA

View Full Version : Combobox not showing value in edit mode?



surindersammy
7 May 2012, 10:00 PM
I have a form with multiple combo and text filed. when i open form with load data(edit mode). the combo showing value field than display fields.
combobox:-


{
name: 'stage_id',
fieldLabel: 'Stage',
displayField:'name',
valueField:'id',
xtype:'combobox',
store:'StagesStore'
},

Store:-


Ext.define('Saas.store.StagesStore', {
alias:'widget.StagesStore',
extend: 'Ext.data.Store',
fields: ['id', 'name'],
data: [
{ name: 'New', id: 1 },
{ name: 'Quotation', id: 2 },
{ name: 'Negotiation', id: 3 },
{ name: 'Won', id: 4 },
{ name: 'Loss', id: 5 }
]
});

when i open select list its showing correct value means displayField or valueField. and when i edit record its showing id value (1,2 etc).

scottmartin
10 May 2012, 2:30 PM
See if this works for you:



// The data store containing the list of states
var store = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
data : [
{ name: 'New', id: 1 },
{ name: 'Quotation', id: 2 },
{ name: 'Negotiation', id: 3 },
{ name: 'Won', id: 4 },
{ name: 'Loss', id: 5 }

]
});

// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose Value',
store: store,
queryMode: 'local',
displayField: 'name',
valueField: 'id',
renderTo: Ext.getBody()
});


Regards,
Scott.

surindersammy
11 May 2012, 1:31 AM
Hi scottmartin,

its not working for me. i am using MVC and loading all stores in controller. When i was using 4.0.7 version then it was worked but now i updated new version 4.1 and its not working.

redraid
11 May 2012, 4:21 AM
//combobox:-
{
name: 'stage_id',
fieldLabel: 'Stage',
displayField:'name',
valueField:'id',
xtype:'combobox',
-store:'StagesStore'
+store: 'Saas.store.StagesStore'
},

//Store:-
Ext.define('Saas.store.StagesStore', {
-alias:'widget.StagesStore',
extend: 'Ext.data.Store',
fields: ['id', 'name'],
data: [
{ name: 'New', id: 1 },
{ name: 'Quotation', id: 2 },
{ name: 'Negotiation', id: 3 },
{ name: 'Won', id: 4 },
{ name: 'Loss', id: 5 }
]
});

surindersammy
11 May 2012, 4:49 AM
Hi redraid,

how can i use.



-store:'StagesStore'
+store: 'Saas.store.StagesStore'

redraid
12 May 2012, 11:55 PM
I mean line with start - to remove, with + to add

jay@moduscreate.com
13 May 2012, 4:32 AM
I have a form with multiple combo and text filed. when i open form with load data(edit mode). the combo showing value field than display fields.
combobox:-
{
name: 'stage_id',
fieldLabel: 'Stage',
displayField:'name',
valueField:'id',
xtype:'combobox',
store:'StagesStore'
},

Store:-
Ext.define('Saas.store.StagesStore', {
alias:'widget.StagesStore',
extend: 'Ext.data.Store',
fields: ['id', 'name'],
data: [
{ name: 'New', id: 1 },
{ name: 'Quotation', id: 2 },
{ name: 'Negotiation', id: 3 },
{ name: 'Won', id: 4 },
{ name: 'Loss', id: 5 }
]
});

when i open select list its showing correct value means displayField or valueField. and when i edit record its showing id value (1,2 etc).

You should be posting code within [ CODE ][ /CODE ] blocks (no spaces).

surindersammy
13 May 2012, 9:06 PM
redraid,
it's not worked.