Treelist pager does not update after datasource updated

5 posts, 1 answers
  1. Randy
    Randy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 27 Dec 2019 Link to this post

    Hi,

    I'm using 2019.3.1023 version. I have a treelist which retrieving data from remote source. When user select a time range in a list the treelist will be triggered to re-fetch the data with the new selected parameter. The datasource is updated succussfully and treelist is refreshed. But the pager is not updated accordingly.

    The treelist configuration:

    $('#gridtable').kendoTreeList({
                    autoBind: false,
                    dataSource: {
                        transport: {
                            read: {
                                url: top.$.rootUrl + '/PPM_Contract/Contract/GetList',
                                dataType: "json",
                                data: function () {
                                    return {
                                        queryJson: JSON.stringify({
                                            // parameters send to remote source
                                        })
                                    };
                                }
                            }
                        },
                        schema: {
                            data: "data",
                            total: function (response) {
                                return response.data.length;
                            },
                            model: {
                                id: "F_Id",
                                parentId: "externalId",
                                expanded: true,
                                fields: {
                                    // some fields setting
                                }
                            }
                        }
                    },
                    filterable: true,
                    sortable: true,
                    resizable: true,
                    selectable: true,
                    pageable: {
                        pageSize: 100
                    },
                    dataBound: function (e) {
                        // some logic for styles
                    },
                    columns:[
                        // some columns
                    ]
                });

     

    The trigger of refreshing the treelist:

    // some parameter assignment
    // then call read method on datasource
    $("#gridtable").data("kendoTreeList").dataSource.read();

     

    With first selection of the parameter, 124 items are returned and 2 pages initialized, which is correct (attached as 1stTry.png).

    With second selection, 248 items returned, total number is updated but the pager is not (should be 3 pages but stays as 2. Attached as 2ndTry.png).

    How to refresh the pager with datasource?

    Thanks.

  2. Tsvetomir
    Admin
    Tsvetomir avatar
    796 posts

    Posted 31 Dec 2019 Link to this post

    Hi Randy,

    I have investigated the provided code snippets and I have noticed that the pageSize option of the data source of the TreeList is missing. Is it possible for you to add it to the declaration and see if it makes a difference?

    I have created a sample project that loads different data on any consecutive click of a button. Check it out here:

    https://dojo.telerik.com/ixEQejED

    In case the issue persists, modify the sample above and send it back to me.

     

    Regards,
    Tsvetomir
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Randy
    Randy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 01 Jan 2020 Link to this post

    Hi Tsvetomir,

    Thank you for replying.

    The page size was included in pageable option. I tried to place the page size in either tree list option or datasource option, but without any difference.

    Actually running your sample I got the same behavoir: the pager does not refreshed after button clicked and there are 4 items cannot be seen. Pls check my screenshots.

     

  4. Answer
    Tsvetomir
    Admin
    Tsvetomir avatar
    796 posts

    Posted 03 Jan 2020 Link to this post

    Hi Randy,

    Thank you for bringing my attention to the displayed items of the pager. I can confirm that this behavior is not expected. What I can recommend is to collapse and expand the first item after calling the read() method. Check out the following Dojo sample:

    https://dojo.telerik.com/aqaviHaN

    I have created an issue in our Feedback portal on your behalf. You could track is progress here:

    https://feedback.telerik.com/kendo-jquery-ui/1447916-treelist-pager-does-not-refresh-after-datasource-update

    Your Telerik points are updated accordingly.

     

    Regards,
    Tsvetomir
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Randy
    Randy avatar
    28 posts
    Member since:
    Sep 2012

    Posted 05 Jan 2020 in reply to Tsvetomir Link to this post

    Hi Tsvetomir,

    Thank you for your suggestion, it works like a charm.

Back to Top