[1.0] MultiCombo Problem Selecting

  1. #1

    [1.0] MultiCombo Problem Selecting

    Hello!
    I am having problem with trying to bind a MultiCombo to a store and allow users to select multiple values. I have no problem populating the drop-downs with the items from a store, but as soon as the MultiCombo loses focus, it seems to lose all the items I've selected. I have tried a simple test and the MultiCombo retained the selected values, but I can't seem to get it work on the original page although the code seems identical.

    Here is what the code would look like:
        <ext:store runat="server" ID="stoMembers" AutoLoad="True" AutoDataBind="True" SerializationMode="Complex" GroupOnSort="True" OnRefreshData="Load_stoMembers">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <Reader>
                <ext:ArrayReader runat="server" IDProperty="LoginName">
                    <Fields>
                        <ext:RecordField Name="FullName" Type="String"/>
                        <ext:RecordField Name="LoginName" Type="String"/>
                        <ext:RecordField Name="MemberObject" IsComplex="True"/>
                    </Fields>
                </ext:ArrayReader>
            </Reader>        
            <SortInfo Field="FullName" Direction="ASC" />        
        </ext:store>
    
        <ext:MultiCombo runat="server" ID="cboTest" FieldLabel="Assigned To" StoreID="stoMembers"
            DisplayField="FullName" ValueField="LoginName" width="800px"
            AutoDataBind="True" Mode="Local">   
            <Listeners>
                <Select Handler='alert("Select: " + this.getValue());'/>
                <Collapse Handler='alert("Collapse: " + this.getValue());'/>
                <Change Handler='alert("Change: " + this.getValue());'/>
                <Blur Handler='alert("Blur: " + this.getValue());'/>
            </Listeners>
        </ext:MultiCombo>
    And here's the server-side code to populate the store:
        protected void Load_stoMembers(object sender, StoreRefreshDataEventArgs e)
        {
                //GetAssignableMembers returns a list of SiteUser object that contains FullName and LoginName of users
                List<SiteUser> userList = GetAssignableMembers(CurrentData, "AssignedTo");
                var dataList = new List<object[]>();
    
                foreach (SiteUser member in userList)
                {
                    dataList.Add(new object[] {member.FullName, member.LoginName});
                }
    
                stoMembers.DataSource = dataList;
                stoMembers.DataBind(); 
            }
        }
    This populates the store with user data, and I can see them in the MultiCombo drop-downs and select them, but as soon as MultiCombo loses focus, the field is set to blank and no items are selected. For testing, I've put listeners on the multicombo and it throws correct value when the items are selected and on collapse, but it does not trigger change event and at the blur event, it indicates MultiCombo contains no value.

    I have tried hard-coding test data and it seemed to work! I have no idea on the difference between this code and the original server-side code:
        protected void Load_stoMembers(object sender, StoreRefreshDataEventArgs e)
        {
                var dataList= new List<object>
                                  {
                                      new object[] {"User A", "AAA"},
                                      new object[] {"User B", "BBB"},
                                      new object[] {"User C", "CCC"}
                                  };
                dataList.Add(new object[] {"User D", "DDD"});
                stoMembers.DataSource = dataList;
                stoMembers.DataBind();
            }
        }
    This works and the multicombo retains value after blur. Any ideas on what the difference is and how to get it working? I've also tried JsonReader and it made no difference.

    Thanks for any help.

  2. #2

    RE: [1.0] MultiCombo Problem Selecting

    Hi,

    1. Do not use ArraReader with generic list (only JsonReader)
    2. I think the problem in you real data. Can you create test sample which reproduces the problem?
  3. #3

    RE: [1.0] MultiCombo Problem Selecting

    Finally found the cause!!!!!!!
    The "FullName" field contained comma as in "Doe, John" and it seems to throw MultiCombo off!! I have verified this by changing the data in the hard-coded test in my previous post and changed "User A" with "User, A" and the MultiCombo does not retain the value!
    I'll try to escape the comma, but MutliCombo should really handle special characters.

    Edit: I can't seem to escape it gracefully.. I've replaced the comma with "&amp;#44;" and it looks good in the drop-down, but when I select the items, it shows up as "Doe &amp;#44; John, Doh &amp;#44; Jane". Perhaps I can change the value string with listener javascript after change event?
  4. #4

    RE: [1.0] MultiCombo Problem Selecting

    Hi,

    Try to change Delimiter property value, by default it uses comma, comma in your value raises conflict
    For example, Delimiter=";"
  5. #5

    RE: [1.0] MultiCombo Problem Selecting

    That worked!
    Thank you!

Similar Threads

  1. Replies: 4
    Last Post: Feb 28, 2013, 8:45 PM
  2. Replies: 2
    Last Post: Mar 15, 2012, 6:04 AM
  3. [CLOSED] Problem selecting items in Combobox
    By tlfdesarrollo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 17, 2012, 6:57 PM
  4. [CLOSED] Problem with selecting values in gridpanel.
    By tlfdesarrollo in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jan 16, 2012, 1:38 PM
  5. Problem when selecting in a combobox
    By feanor91 in forum 1.x Help
    Replies: 17
    Last Post: Jan 16, 2012, 8:28 AM

Posting Permissions