This is a migrated thread and some comments may be shown as answers.

Treelist pager does not update after datasource updated

4 Answers 586 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Veteran
Randy asked on 27 Dec 2019, 11:47 AM

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.

4 Answers, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 31 Dec 2019, 08:05 AM

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.
0
Randy
Top achievements
Rank 1
Veteran
answered on 02 Jan 2020, 03:46 AM

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.

 

0
Accepted
Tsvetomir
Telerik team
answered on 03 Jan 2020, 12:48 PM

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.
0
Randy
Top achievements
Rank 1
Veteran
answered on 06 Jan 2020, 02:42 AM

Hi Tsvetomir,

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

Tags
TreeList
Asked by
Randy
Top achievements
Rank 1
Veteran
Answers by
Tsvetomir
Telerik team
Randy
Top achievements
Rank 1
Veteran
Share this question
or