ComboBox bug Value equals Text

  1. #1

    ComboBox bug Value equals Text



    I have a details popup panel to see details of a selected record in a gridpanel. Everytime I popup the details panel I load a combobox with inner items like so:


    cmbMessageCats.Items.Clear();
    cmbMessageCats.Items.Add(new Coolite.Ext.Web.ListItem("Christmas", "5"));
    cmbMessageCats.Items.Add(new Coolite.Ext.Web.ListItem("General", "1"));
    cmbMessageCats.Items.Add(new Coolite.Ext.Web.ListItem("Valentine's Day", "4"));
    cmbMessageCats.SelectedItem.Value = "1"; //default to general

    if I put a break point and look at the ItemsToStore private variable it's set to:


    new Ext.data.SimpleStore({fields:['text','value'],data :[["Christmas","5"],["General","1"],["Valentines Day","4"]]})

    which is good. It shows all three items in the combobox "Christmas", "General", and "Valentines Day" with "General" selected.


    However after a few times displaying the details panel and closing, it no longer shows "General" but shows "1" and no other items are displayed. When I put a breakpoint on it the ComboBox's Text = "1" and Value="1", but still the ItemsToStore field shows the same data as above with the correct Description and ID.


    The only way I can get the combobox to load the data and display data correctly is to stop my project in VS, and relaunch again.


    What is going on?


    Jason



  2. #2

    RE: ComboBox bug Value equals Text

    Hi,

    We'll need to see a full sample which demonstrates how to reproduce the problem,

    http://forums.ext.net/showthread.php...ing-New-Topics
    Last edited by geoffrey.mcgill; Feb 19, 2011 at 5:39 AM.
  3. #3

    RE: ComboBox bug Value equals Text

    I think I am having the same problem, I am using coolite 8.x and when the combo box creates the simple store it is not passing the id field to use as a config param so the store is auto generating the ids, this makes the getById method not work because it is looking for the auto generated id numbers.

    Here is what coolite rendered to build my combo.
    
    new Coolite.Ext.TriggerComboBox({
                    id: "ctl00_MainContent_ctl00_cboEditorField_AgentName",
                    xtype: "coolitetriggercombo",
                    store: new Ext.data.SimpleStore({
                        fields: ["text", "value"],
                        data: [
                            ["Value1", "15"],
                            ["Value2", "14"],
                            ["Value3", "27"]
                        ]
                    }),
                    valueField: "value",
                    triggerAction: "all",
                    queryDelay: 10,
                    mode: "local",
                    hiddenName: "ctl00_MainContent_ctl00_cboEditorField_AgentName_Value",
                    displayField: "text"
                }),
    according to the extjs docs:

    <table class="member-table" style="background-color: white; width: 855px; margin-bottom: 10px;" cellspacing="0"><tbody><tr class=" alt" style="background-color: rgb(241, 241, 241);"><td class="sig" style="margin: 0px; padding: 2px 15px 2px 2px; font-size: 13px; vertical-align: top;"><br class="Apple-interchange-newline">id : Number</td><td class="msource" rowspan="2" style="border-right: 1px solid rgb(187, 187, 187); border-bottom: 1px solid rgb(187, 187, 187); margin: 0px; padding: 2px 15px 2px 2px; font-size: 13px; vertical-align: top; width: 100px;">SimpleStore</td></tr><tr class=" alt" style="background-color: rgb(241, 241, 241);"><td class="mdesc" style="border-bottom: 1px solid rgb(187, 187, 187); margin: 0px; padding: 0px 15px 2px 2px; font-size: 13px; vertical-align: top;">The array index of the record id. Leave blank to auto generate ids.</td></tr></tbody></table>
    so i think coolite should add the id option to the store config with a value of 1 to indicate that the 'value' field should be used for ids. The only problem is I have now idea where in code this is being done :)


Similar Threads

  1. Replies: 2
    Last Post: Sep 15, 2014, 2:58 PM
  2. Replies: 1
    Last Post: Jul 26, 2012, 1:18 PM
  3. Editor text and combobox
    By threewonders in forum 1.x Help
    Replies: 1
    Last Post: May 21, 2011, 11:25 AM
  4. Replies: 10
    Last Post: Apr 05, 2010, 1:42 AM
  5. How to validate the value not the text of a combobox
    By charlie_brown in forum 1.x Help
    Replies: 1
    Last Post: Dec 02, 2009, 5:50 PM

Posting Permissions