How would I refresh my listview data on a timed schedule?

1 Answer 167 Views
ListView
Jay
Top achievements
Rank 1
Iron
Iron
Jay asked on 30 Jun 2021, 03:59 PM
I'm creating a dashboard app and I have a listview to retrieve some data. I want to re-fetch the data ever 10 minutes. Do I use javascript setInterval()  or do you have some built in function on your datasource to do this? I assume Telerik would do this on most of your gauges and charts components.

1 Answer, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 01 Jul 2021, 11:30 AM

Hello Jay,

I already responded to the suport thread and am posting the answer here as well:

Indeed setInterval() would be the way to implement such functionality. For example: 

$(function () {
          $("#listView").kendoListView({
            dataSource: dataSource,
            template: kendo.template($("#template").html())
          });
          
          setInterval(function (){ readData();}, 300000);
        });

        function readData() {
          var lv = $("#listView").getKendoListView()
          lv.dataSource.read();
        }

Here is a runnable dojo that reads the ListView's dataSource every 5min.

Regards,
Aleksandar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ListView
Asked by
Jay
Top achievements
Rank 1
Iron
Iron
Answers by
Aleksandar
Telerik team
Share this question
or