[CLOSED] ComboBox inside a Grid (editor)

  1. #1

    [CLOSED] ComboBox inside a Grid (editor)

    Hi all,
    I have a grid with a combobox inside it:

    <ext:Column Header="Foo" Width="150">
         <Editor>
         <ext:ComboBox Mode="Local" StoreID="MyStore" DisplayField="Name" ValueField="Value"
                   ID="MyCombo" ReadOnly="true" runat="server" ForceSelection="true" TriggerAction="All"
                    Shadow="Drop" />
         </Editor>
    </ext:Column>
    I'm loading some data from a store inside the combobox; the data is loaded correctly, but nothing is displayed inside the combo until I click on it.
    I need to set a "default" value to be displayed inside the grid cell until the user clicks on it; once a value has been selected, I need it to be displayed inside that cell.
    I give you an example:

    ---

    1. Initial state

    combo: [default value is displayed]

    2. User clicks on it and the combo expands:

    combo: [value 1]
    [value 2]
    [value n]
    3. User selects value 2:

    combo: [value 1]

    [value 2]

    [value n]
    4. value2 is displayed inside the grid cell :

    combo: [value2 is displayed]

    ---

    From the code above, after selecting a value nothing is displayed inside the cell and the cell is still empty.
    Maybe I should use a renderer, but I don't know how to access the combo's selected value, if there's any.

    Any help would be appreciated,
    thanks in advance,

    ps. I am using coolite 0.8.2 and .net framework 2.0
  2. #2

    RE: [CLOSED] ComboBox inside a Grid (editor)

    Hi,

    Please see the following sample
    https://examples1.ext.net/#/GridPane...Field_Mapping/
  3. #3

    RE: [CLOSED] ComboBox inside a Grid (editor)

    Dear Vlad,
    I've already tried to use the code in the example you linked, but I can't have it working.

    I get a "MyStore not defined" exception.

    Here is my code:

     var myRenderer = function(value) {
                var r = MyStore.getById(value);
    
                if (Ext.isEmpty(r)) {
                    return "";
                }
    
                return r.data.MyField;
            }
        <ext:Store ID="MyStore" runat="server" AutoLoad="false">
            <Proxy>
                <ext:HttpProxy Timeout="30000" runat="server" Method="POST" Url="MyMethod" />
            </Proxy>
            <Reader>
                <ext:XmlReader Record="MyRecord" ReaderID="MyReaderID">
                    <Fields>
                        <ext:RecordField Type="String" Mapping="MyRecordField" Name="MyField" />
                    </Fields>
                </ext:XmlReader>
            </Reader>   
        </ext:Store>
    <ext:Column Header="Actions" Width="150" Tooltip="Please select a role">
          <Renderer Fn="myRenderer " />
                   <Editor>
                       <ext:ComboBox Mode="Local" StoreID="MyStore" DisplayField="MyField" ValueField="MyField"
                                    ID="MyCmb" ReadOnly="true" runat="server" ForceSelection="true" TriggerAction="All"
                                     Shadow="Drop" />
                   </Editor>
    </ext:Column>
    What did I do wrong? Is it necessary to put the js code inside the <head> tags?
  4. #4

    RE: [CLOSED] ComboBox inside a Grid (editor)

    Hi,

    1. If DisplayField=ValueField the renderer is not required
    2. To understand whats wrong I need to see whaty data you bind to the grid and what data contains the combo


    Can create simple solution with test data and post it?
  5. #5

    RE: [CLOSED] ComboBox inside a Grid (editor)

    Thank you Vlad,
    without the renderer the data retrieved with the store is displayed correctly, but I do need to mantain the selected value from the combo inside the grid cell (this doesn't happen now).
    Nothing is displayed inside the cell until I select it and the editor starts editing itself.
    Is it possible to solve this?
    Thanks,
  6. #6

    RE: [CLOSED] ComboBox inside a Grid (editor)

    Hi,

    Please provide more details.


    Do you have cell with value (which is displaying) but when you switch to the edit mode the combo is empty?
  7. #7

    RE: [CLOSED] ComboBox inside a Grid (editor)

    I have a cell that contains a combo.
    The combo's store is loaded (so the combo is filled) when I select the row.
    Then, if I click on the cell, the combo is displayed (the cell becomes editable) and every item retrieved with the store is displayed inside the combo, as combo items.
    If I click outside the grid or if I select another row the cell becomes empty again.
  8. #8

    RE: [CLOSED] ComboBox inside a Grid (editor)

    Hi,

    Are you sure that MyStore has 'MyReaderID' field? ReaderID is id field name.
    Try to remove ReaderID from MyStore
  9. #9

    RE: [CLOSED] ComboBox inside a Grid (editor)

    Hi Vlad,
    I solved it.
    I wasn't associating any dataIndex to the combo column, so nothig was displayed.
    Thanks for your help.

Similar Threads

  1. Combobox Grid Editor Dynamic
    By sysmo in forum 1.x Help
    Replies: 0
    Last Post: Aug 08, 2012, 7:36 PM
  2. Replies: 0
    Last Post: Sep 08, 2011, 9:59 AM
  3. [CLOSED] ComboBox editor in grid
    By PatrikG in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 08, 2010, 4:30 PM
  4. ComboBox Editor inside GridPanel
    By jsemple in forum 1.x Help
    Replies: 1
    Last Post: Feb 27, 2009, 11:58 AM
  5. [CLOSED] ComboBox AjaxEvents within Grid Editor
    By conman in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 24, 2009, 7:35 PM

Posting Permissions