This is a migrated thread and some comments may be shown as answers.

Angular server-side filtering

4 Answers 173 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 12 Aug 2014, 01:27 PM
General goal here is to have a searchable dropdownlist that:

1. Doesn't request all records from the server when it first loads.
2. Allows me to control the number of characters entered in the search box before the server filter is fired.
3. I don't know what Angular directive is used to make the dropdown show the filter ... k-filter ?  filter ?

<input id="customerSearch" placeholder="Search Customer"
                           kendo-widget-name="customerSearch"
                           kendo-drop-down-list
                           k-on-select="customer_select(kendoEvent)"
                           k-suggest="true"
                           k-height="100"
                           k-data-text-field="'customer.name'"
                           k-data-value-field="'id'"
                           k-data-source="customerSearchDataSource"
                           filter="startswith"
                           ng-model="search"
                           k-template="'<span>${ data.customer.name }</span>'">

4 Answers, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 12 Aug 2014, 08:37 PM
One thing for sure, I have to set "filter" in code like:

$scope.customOptions = {   filter: "startswith"   };

 k-options="customOptions"

If I try to set this using directives like:   filter="startswith" or k-filter="startswith" it doesn't work.

Please advise.
0
Mihai
Telerik team
answered on 13 Aug 2014, 07:28 AM
Hi Tim,

You have to quote the string, like you did with dataTextField and dataValueField.  So: k-filter="'startswith'".

Also, there is no kendo-widget-name directive.  If you wish to get a reference to the widget in $scope, do kendo-drop-down-list="customerSearch".

Regards,
Mihai
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Tim
Top achievements
Rank 1
answered on 13 Aug 2014, 01:00 PM
Thanks Mihai.

This is working now, however the last issue I have is there is not way to stop the widget requesting all records from the datasource BEFORE it is filtered.  Consider an item table with 100k rows, I want a drop down that can search this, but I can't have it initially load 100k rows.
0
Atanas Korchev
Telerik team
answered on 15 Aug 2014, 06:36 AM
Hi Tim,

You could try setting the autoBind option to false. Setting minLength to a value bigger than the default could also help.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
Tim
Top achievements
Rank 1
Answers by
Tim
Top achievements
Rank 1
Mihai
Telerik team
Atanas Korchev
Telerik team
Share this question
or