Server-side grouping and function mode read: kendo function convertGroup fail

3 posts, 1 answers
  1. Claudio
    Claudio avatar
    21 posts
    Member since:
    Feb 2015

    Posted 04 Nov 2015 Link to this post

    Hi, i'm using a kendo grid for server paging, sorting and filtering and now i would like to add grouping functionality:

    I use "function mode" to read data, so dataSource is configured as:

    let dataSource: any = {
                    batch: true,
                    serverPaging: true,
                    serverSorting: true,
                    serverFiltering: true,
                    serverGrouping: true,
                    page: 1,
                    pageSize: 20,
                    transport:
                    {
                        read: function (options)
                        {

    kendo.data.transports["aspnetmvc-ajax"].fn.options.options = { prefix: '' };
                            let request = kendo.data.transports["aspnetmvc-ajax"].fn.options.parameterMap(options.data, "read", false);

                            thisObject.httpService.GetNodes(request)
                            .then(function (args: IHttpServiceParameters)
                            {
                                options.success(args.data);
                            });
                       }
                    },
                    schema:
                    {
                        data: function (data)
                        {
                            return data.Data;
                        },
                        total: function (data)
                        {
                            return data.Total;
                        },
                        groups: function (data)
                        {
                            return data.Data;
                        },
                        model: model
                    }
         }

     

     

  2. Answer
    Daniel
    Admin
    Daniel avatar
    2144 posts

    Posted 06 Nov 2015 Link to this post

    Hello Claudio,

    Since the dataSource type is not set to "aspnetmvc-ajax", you will need to set the groups function from the "aspnetmvc-ajax" schema in order to avoid the problem:
    groups: kendo.data.schemas["aspnetmvc-ajax"].groups
    This will also be needed for the aggregates option if you are using server aggregates:
    aggregates: kendo.data.schemas["aspnetmvc-ajax"].aggregates


    Regards,
    Daniel
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Claudio
    Claudio avatar
    21 posts
    Member since:
    Feb 2015

    Posted 11 Nov 2015 in reply to Daniel Link to this post

    Thanks it works!
Back to Top