[CLOSED] Combobox: How to remove the duplicate items in the combobox?

  1. #1

    [CLOSED] Combobox: How to remove the duplicate items in the combobox?

    Hi,

    I have a Combobox, and it bind a store,
    <ext:Combobox StoreID="Store1" DisplayField="Name" ValueField="Id" ID=Combobox1" runat="server>
    </ext:Combobox>
    Now, there are some duplicate items in the combobox,
    --
    ID Name
    1 A
    1 A
    1 A
    2 B
    2 B
    3 C
    --
    Is there some simple way to remove the duplicate items?

    And then the result is:
    --
    ID Name
    1 A
    2 B
    3 C
    --

    Please don't remove them in the Store, because the duplicate items in the store is necessary for other GridPanel

    Thanks.
    Last edited by Daniil; May 17, 2011 at 1:53 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I'm not sure that non-unique ids is good, but I believe you need that.

    Please don't remove them in the Store, because the duplicate items in the store is necessary for other GridPanel
    Well, a single way I see is filtering a store. But it will apply to both - combo and grid as they have the same store. Are they (combo and grid) placed at the same view? Could you also provide some more details about your requirements?

    To filter a store you can use the following code.
    var uniqueIds = Store1.collect("id");
    Store1.filterBy(function (r) {
        var id = r.data.id;
        if (uniqueIds.indexOf(id) !== -1) {
            uniqueIds.remove(id);
            return true;
        } else {
            return false;  
        }
    });
    To clear filter please use:
    Store1.clearFilter()

Similar Threads

  1. [CLOSED] [1.3] Duplicate Items on Combo
    By MP in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 18, 2012, 5:18 PM
  2. Replies: 4
    Last Post: Nov 30, 2011, 5:25 AM
  3. [CLOSED] Combobox: remove all items on AjaxEvents
    By Arcanjo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 25, 2010, 2:30 PM
  4. Replies: 1
    Last Post: Nov 05, 2009, 8:23 AM
  5. [CLOSED] Combobox remove all values
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 18, 2009, 10:33 AM

Posting Permissions