kendo grid initial sort visual

3 posts, 0 answers
  1. miki
    miki avatar
    2 posts
    Member since:
    Jul 2016

    Posted 01 Aug Link to this post

    I am trying to define an initial sort.

    as far as the request, the sort is working and the data comes sorted.

    the problem is that in the header, the visual arrow of sort column and direction is not shown.

    only after physical click on the column it shows.
    please help, this is the used code:

    $scope.mainGridOptions = {
                dataSource: {
                    sort: { field: "email", dir: "desc"},
                    serverPaging: true,
                    serverSorting: true,
     
                    pageSize: 50,
                    transport: {
                        read: {
                            type: "GET",
                            dataType: "json",
                            url: "/p/enduser/licenses/allocation/listWithDevices",
                            headers: {
                                "X-AUTH-TOKEN": authService.getToken()
                            }
                        },
                        parameterMap: function(data, type) {
                            if (type == "read") {
                                console.log(data);
                                return {
                                    pageSize: data.take,
                                    page: (data.skip/data.take),
                                    sortBy: data.sort?data.sort[0].field:null,
                                    sortDir: data.sort?data.sort[0].dir:null
                                }
                            }
                        }
                    },
     
                    schema: { data: "items", total: "itemsCount" }
                },
                height: $scope.resize(),
                scrollable: {
                    virtual: true
                },
                sortable: {
                    allowUnsort: false,
                    mode:'single'
                }
            };

  2. miki
    miki avatar
    2 posts
    Member since:
    Jul 2016

    Posted 01 Aug in reply to miki Link to this post

    Here is a demo i made in dojo:

    http://dojo.telerik.com/esuQI/2

    (Even though the web-server doesnt support sorting, the request is going as sort request, but the visual doesnt represent it.)

    after physical sort on column the arrow appears.

  3. Kendo UI is VS 2017 Ready
  4. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    356 posts

    Posted 02 Aug Link to this post

    Hello Miki,

    If the server is properly configured, the initial sorting is also visualized in the column header cell:

    http://dojo.telerik.com/axOga

    The visual indication works as expected for client side sorting via the dataSource.sort option as well:

    http://dojo.telerik.com/EYiwE

    You can find out more about server data operations in the following sections of our documentation:

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

    http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/web-api-server-operations

    I hope this helps, but do not hesitate to contact us if you need further assistance.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top