ListView, setDataSource and paging

1 Answer 151 Views
Data Source ListView Pager
Daniel
Top achievements
Rank 1
Iron
Daniel asked on 13 Dec 2022, 12:19 AM

Hi,

We're not sure if this is a bug or feature.

Using ListView and the method setDataSource with the built-in paging. The ListView appears to change data sources but the paging doesn't. Tried using the refresh() method but same result.

We worked around it by using the Pager widget and ListView without the bulit-in paging and this seems to work okay.

It's not a problem. Just found it weird that we do the same for a Grid on the same page using the method setDataSource and the data source changes okay along with the paging.

Any thoughts?

Thanks
// First load
var dataSourceListView = new kendo.data.DataSource({
	data: dataSource,
	pageSize: 8
});

$("#listView").kendoListView({
	dataSource: dataSourceListView,
	dataBound: function () {
	},
	template: kendo.template($("#template").html()),
	pageable: true	
});

// Not first load
$("#listView").data("kendoListView").setDataSource(dataSourceListView);
//$("#listView").data("kendoListView").refresh();

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 15 Dec 2022, 09:34 AM

Hi, Daniel,

Thank you for the provided details.

This behavior does seem incorrect and inconsistent, I've logged an issue about it in our public GitHub repository:

https://github.com/telerik/kendo-ui-core/issues/7154 

Workaround

You can call the internal _pageable method after calling setDataSource to reset the Pager component as well:

          listView.setDataSource(dataSource);
          listView._pageable();

Dojo

https://dojo.telerik.com/@gdenchev/uSUHAwUD 

I've also added some Telerik Points to your account as a sign of gratitude for reporting this behavior.

Best Regards,
Georgi Denchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Data Source ListView Pager
Asked by
Daniel
Top achievements
Rank 1
Iron
Answers by
Georgi Denchev
Telerik team
Share this question
or