Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
560
How to prevent selection unless clicked or user presses enter
posted

I have the following:

    $("#txtSearch").igCombo({

        nullText: "Search...",

        autoComplete: false,

        valueKey: "ID",

        textKey: "Name",

        textKeyType: "string",

        enableActiveItem: false,

        showDropDownButton: false,

        loadOnDemandSettings: {

            enabled: true,

            pageSize: 10

        },

        dataSourceUrl: "/api/v1/contacts/GetContactInfo?AssociatesOnly=false",

        filteringType: "remote",

        filteringCondition: "startsWith",

        responseTotalRecCountKey: "TotalCount",

        itemTemplate: '<article class="search-results"><img src="/contactphoto/Thumbnail?ContactID=${ID}"/><h3>${Name}</h3><strong>City: ${City}#<br/>State: ${State}</article>',

        responseDataKey: "Results",

        width: "200px",

        selectionChanged: function (evt, ui) {

            if (ui.items == null || ui.items.length == 0)

                return;

 

            var item = ui.items[0];

            debugger;

            window.location.href = "/members/publicprofile?id=" + item.value;

        }

    });

 

my problem is that selectionChanged is getting called as soon as there is a match. autoComplete is false as is enableActiveItem. I would have thought that that would have prevented a selection except for if the user actively used the arrows and hit enter on an item or clicked on an item in the drop down, but it fires after 2 characters.

How would one go about preventing the selection from changing except in those two cases?

thanks!

  • 7566
    posted

    Hello Geminiman,

     

    You can cancel the selectionChanging event, handle keypress of the menu and manually to select any item. This could be a custom implementation and this scenario is not common and is not supported currently.

     

    If you need further assistance do not hesitate to contact me.

     

    Sincerely,

    Georgi Sashev

    Developer Support Engineer

    Infragistics, Inc.

    http://es.infragistics.com/support