Jun 22, 2012, 2:42 PM
Combobox in GridPanel show value when DoubleClick for Editing
Hi,
I have a problem with a ComboBox in a GridPanel.
The Combobox is populated at in:
The render function named "nameRenderer" is defined as:
The problem is when I DoubleClicking on the Combobox for editing because in the combox text I see the "value" of the Combobox and not the "text":
EG: (in this sample I want to see "Text3" and not the value "3")
Can you help me to resolve this issue?
Thank you very much!
Stefano Lonati
I have a problem with a ComboBox in a GridPanel.
The Combobox is populated at in:
protected void Page_Load(object sender, EventArgs e)
{
this.ComboBox2.Items.Add(new Ext.Net.ListItem("Text1", "1"));
this.ComboBox2.Items.Add(new Ext.Net.ListItem("Text2", "2"));
this.ComboBox2.Items.Add(new Ext.Net.ListItem("Text3", "3"));
}
In the GridPanel, in the aspx file, the comboBox is defined as:<ext:Column ID="Column4" runat="server" DataIndex="Profilo" Text="Profilo">
<Renderer Fn="nameRenderer"/>
<Editor>
<ext:ComboBox ID="ComboBox2" runat="server" DisplayField="Text" ValueField="Value">
<Store>
<ext:Store ID="Store2" runat="server">
<Model>
<ext:Model ID="Model2" runat="server" IDProperty="Value">
<Fields>
<ext:ModelField Name="Text" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</Editor>
</ext:Column>
The render function named "nameRenderer" is defined as:
var nameRenderer = function (value) {
var itemCombo = Ext.getCmp('ComboBox2');
var r = itemCombo.getStore();
if (this.columns[3].initialConfig.editor.field.mergeItems != null) {
var conto = this.columns[3].initialConfig.editor.field.store.getCount();
var r = this.columns[3].initialConfig.editor.field.mergeItems;
for (i = 0; i < conto; i++) {
var valore = r[i][0];
var testo = r[i][1];
if (valore == value) {
return testo;
}
}
}
return value;
};
The problem is when I DoubleClicking on the Combobox for editing because in the combox text I see the "value" of the Combobox and not the "text":
EG: (in this sample I want to see "Text3" and not the value "3")
Can you help me to resolve this issue?
Thank you very much!
Stefano Lonati