data method - set data and total

3 posts, 1 answers
  1. Matjaž
    Matjaž avatar
    82 posts
    Member since:
    Jul 2015

    Posted 09 Sep 2016 Link to this post

    I want to set data with data method(data), but I want to tell different total that is the size of array. Something like this:

    dataSource.data({ data: this.asArray, total: this._rowCount});

    How can I do that without setting transport option?

  2. Answer
    Stefan
    Admin
    Stefan avatar
    1262 posts

    Posted 12 Sep 2016 Link to this post

    Hello Matjaž,

    The total number of the data can be set using only the schema.total property of the Kendo UI DataSource:

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.total

    Let me know if you need additional information on this matter.

    Regards,
    Stefan
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Matjaž
    Matjaž avatar
    82 posts
    Member since:
    Jul 2015

    Posted 16 Sep 2016 Link to this post

    No it helps enough. Didn't think I can use schema -> total/data without transport. Thank you.

    const o: kendo.data.DataSourceOptions = {
        pageSize: options.pageSize,     
        schema: {
            total: () =>
            {
                return this._rowCount;
            },
            data: () =>
            {
                return this.asArray;
                 
            },
            model: this.getKendoModal()
        },
        page: 0,
        serverAggregates: true,
        serverFiltering: true,
        serverGrouping: true,
        serverPaging: true,
        serverSorting: true
    };

Back to Top