Combobox in GridPanel show value when DoubleClick for Editing

  1. #1

    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:

    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")

    Click image for larger version. 

Name:	problem_combo.jpg 
Views:	484 
Size:	42.8 KB 
ID:	4398



    Can you help me to resolve this issue?
    Thank you very much!

    Stefano Lonati
  2. #2
    Anyone can help me please?
    Thank you!

    Stefano Lonati
  3. #3
    Hi,

    Please look at the Department column here:
    https://examples2.ext.net/#/GridPane...Field_Mapping/

    Seems it works as you need.

Similar Threads

  1. [CLOSED] Editing cell of gridPanel
    By supera in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: May 23, 2012, 12:47 PM
  2. Replies: 2
    Last Post: May 05, 2011, 10:16 AM
  3. Editing GridPanel attached to a SQLDatasource
    By tnwheeler in forum 1.x Help
    Replies: 2
    Last Post: Aug 30, 2010, 9:58 PM
  4. Replies: 10
    Last Post: Jan 04, 2010, 4:37 PM
  5. Inline Editing in a Grid using combobox
    By gido in forum 1.x Help
    Replies: 3
    Last Post: Sep 11, 2009, 6:55 AM

Tags for this Thread

Posting Permissions