Does ComboBox virtualization ONLY work with OData dataSources?

4 posts, 1 answers
  1. Ian
    Ian avatar
    12 posts
    Member since:
    Sep 2017

    Posted 31 Oct Link to this post

    I can't get it to work with a JSON REST services that uses a {"total": 100, "data": [{...}]} format. 
  2. Dimitar
    Admin
    Dimitar avatar
    217 posts

    Posted 01 Nov Link to this post

    Hello Ian,

    The ComboBox widget can work with JSON REST service. Make sure that the schema.data and schema.total configuration options of the dataSource are being set correctly:
    schema: {
      model: {
        fields: {
          ProductID: { type: "string" },
          ProductName: { type: "string" },
        }
      },
      total: "Total",
      data: "Data"
    }

    In addition to the above, I have prepared a sample ASP.NET MVC solution for your reference, where you can find a working example of a ComboBox Virtualization with JSON (initialized with jQuery). 

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Ian
    Ian avatar
    12 posts
    Member since:
    Sep 2017

    Posted 01 Nov in reply to Dimitar Link to this post

    It wasn't expressly clear that the dataSource must have

        serverFiltering: true

    set in its config before the virtual scrolling feature would work. 

    Adding serverFiltering: true to my datasource has fixed it.

     

  4. Answer
    Dimitar
    Admin
    Dimitar avatar
    217 posts

    Posted 02 Nov Link to this post

    Hello Ian,

    I am glad to hear that you have successfully resolved the issue.

    In general, it is recommended that all data operations (paging, sorting, filtering, grouping, and aggregates) are configured to take place either on the server, or on the client. Mixing them might lead to undesired side-effects. In the current scenario where serverPaging is enabled and serverFiltering is disabled, the DataSource will filter only the current data page and you will see less results than expected. This is described in the DataSource's Mixed Data Mode Operations Documentation.

    In addition to the above, the minimal widget and DataSource configuration for enabling virtualization is shown in this section of the ComboBox Virtualization Article

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top