jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Filter out Duplicates

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 13 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Filter out Duplicates #3524

    binfch
    Participant

    Hi there

    I have a combobox with:

    var srcCompany = { datatype: "array", localdata: CompanyDataArray };
    var datCompany = new $.jqx.dataAdapter(srcCompany);
    $("#cmbImpCompany").jqxComboBox({ source: datCompany, displayMember: "CompanyName", valueMember: "CompanyId" });

    The CompanyDataArray contains many fields. For the combobox I just need “CompanyName” and “CompanyId”. This code works but with dupplicates

    -> What would be the recomended way to avoid dupplicates?

    Thx & cheers,
    P.

    Filter out Duplicates #3541

    Peter Stoev
    Keymaster

    Hi binfch,

    You can specify an unique DataField to the DataAdapter. This will filter out the duplicate records.

                    var dataAdapter = new $.jqx.dataAdapter(source, {
    autoBind: false,
    async: false,
    uniqueDataFields: ["ContactTitle"]
    }
    );

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Filter out Duplicates #3606

    binfch
    Participant

    Hi Peter

    Thanks for the info -> This works great but I have another question.

    The “source” data array looks like:

    Right now I filter/extract (in a separate/new array) the 2 columns “DepartmentId” and “DepartmentName” for “CompanyId = 3” before using/assigning these in a jqxComboBox.

    This process takes some time and I was wondering if there is a more performant/better way to directly use the “source” data array in the jqxComboBox (without passing through the mentioned extra step)?

    Thanks & cheers,
    Peter

    Filter out Duplicates #3654

    Peter Stoev
    Keymaster

    Hi Peter,

    I am afraid that there’s no built-in filtering in the jqxDataAdapter. It is only possible to filter the duplicate records by using a code like in my previous post.

    Best Regards,
    Peter Stoev

    jQWidgets team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.