Angular server-side filtering

5 posts, 0 answers
  1. Tim
    Tim avatar
    8 posts
    Member since:
    Nov 2012

    Posted 12 Aug 2014 Link to this post

    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>'">
  2. Tim
    Tim avatar
    8 posts
    Member since:
    Nov 2012

    Posted 12 Aug 2014 Link to this post

    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.
  3. Kendo UI is VS 2017 Ready
  4. Mihai
    Admin
    Mihai avatar
    153 posts

    Posted 13 Aug 2014 Link to this post

    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!
     
  5. Tim
    Tim avatar
    8 posts
    Member since:
    Nov 2012

    Posted 13 Aug 2014 in reply to Mihai Link to this post

    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.
  6. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 15 Aug 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready