We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

FIlter box with autocomplete

Hi,

i have a grid, with url adaptor, virtual scrolling and filterType = menu. 
When i type in the textbox, the autocomplete use the selected operator and not always the startswith or the contains operator. The operator dropdown would be use to filter the data in the grid and not the item list of aoutocomplete.

Can i change this behaviour?

Thanks
Regards
Stefano


3 Replies

AS Alan Sangeeth S Syncfusion Team December 7, 2015 12:55 PM UTC

Hi Stefano,

Thanks for using Syncfusion products.

We have achieved your requirement “AutoComplete suggestion operator must be specified exclusively and not from Filter Menu Dropdown” by using “focuIn” Autocomplete event. Please refer the following code example.

$("#Grid").ejGrid({


//To bind the autocomplete “focusIn” event, as soon as Grid is rendered

dataBound: function (args) {

                var proxy = this;

                setTimeout(function (e) {

                    $("#" + proxy.element.attr("id") + "_acString").ejAutocomplete({focusIn:"customFocusIn"});

                }, 100);

            }

    });

    function customFocusIn(args) {

        this.model.filterType = "endsWith";

    }

</script>



We have created a sample that can be downloadable from below link.
http://www.syncfusion.com/downloads/support/forum/121329/ze/EJGrid817178846

Regards,
Alan Sangeeth S


SE Stefano Enrico December 9, 2015 10:48 AM UTC

Hi,

I didn't explain it well. I don't want to set an operator on dropdown, but i want that the textbox "filter value" use the startWith operator, independently by selected operator. The selected operator will be use only to filter the grid data.


Thanks
Regards
Stefano


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team December 10, 2015 05:53 AM UTC

Hi Stefano,

In our last update, we had suggested that you change the filterType for autocomplete suggestion to “endsWith”. In the focusin event of the ejAutocomplete, give the filterType as “StartsWith”, instead of “endsWith”, which will suggest the items independent of the operator selected from the dropdown. Please refer to the code example and screenshot.

$("#Grid").ejGrid({

            allowFiltering: true,

            filterSettings: { filterType: "menu" },

            allowScrolling: true,

            scrollSettings: { height: 300, allowVirtualScrolling: true, virtualScrollMode: ej.Grid.VirtualScrollMode.Normal },

            dataSource:  ej.DataManager({

                url: "/Home/DataSource", adaptor: new ej.UrlAdaptor()

            }),

            columns: [

                    { field: "OrderID", isPrimaryKey: true, headerText: "Order ID" },

                     . . . .

            ],

            dataBound: function (args) {

                var proxy = this;

                setTimeout(function (e) {

                    $("#" + proxy.element.attr("id") + "_acString").ejAutocomplete({

                        focusIn: function (args) { this.model.filterType = "StartsWith";//always suggest you startsWith word independent of the operator selected }

                    });

                }, 100);

            }
        });





We have prepared a sample with the above solution that can be downloaded from the following location.

http://www.syncfusion.com/downloads/support/forum/121329/ze/FilterMenu_MVC327453155

If we had misunderstood your query, please send the replication procedure. It will be helpful to analyze the issue and provide a solution as early as possible.

Regards,
Seeni Sakthi Kumar S.

Loader.
Live Chat Icon For mobile
Up arrow icon