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

How to refresh listView with Template

6 Answers 414 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 17 Apr 2012, 03:39 PM
The below function reads from a specific URL and loads the contents into myDiv using a template and listView.  The function works perfect the first time.  How can I force the view to refresh with new data each time the function runs (the function is triggered externally)?

function loadNewFeed(url) {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: url,
dataType: "json"
}
}

});
$('#myDiv').kendoListView({
dataSource: dataSource,
template: kendo.template($("#reviewsTemplate").html())
});

};

6 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 17 Apr 2012, 06:10 PM
I've been testing this issue further, and have found the following:

When the function first runs, it executes perfectly and renders the data via the template.

Upon subsequent runs the following javascript error occurs in Firebug:

Error: "b is null"

Script: kendo.all.min.js (line 8)

Can someone from Telerik, please respond and let me know if there is a solution to this issue?

thanks,


0
Petyo
Telerik team
answered on 18 Apr 2012, 09:14 AM
Hi,

Re-initializing the widget each time is not supported. You should create the datasource (and the widget) once, and then subsequently use the DataSource read method for data fetching. 

All the best,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mike
Top achievements
Rank 1
answered on 18 Apr 2012, 02:59 PM
Petyo,

Thanks for the info.  I tried using the read method, but it didn't work.  Using the above example can you give me an example of where/how to use the read method?

Thanks,

0
Petyo
Telerik team
answered on 18 Apr 2012, 03:26 PM
Hi,

Not really, as I don't see your project, and don't know what your business logic is. In general, you should call it where you are currently using the loadNewFeed. If need further assistance, I would like to recommend opening a support ticket with a sample project attached, so that we can assist you further. 

Kind regards,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mike
Top achievements
Rank 1
answered on 18 Apr 2012, 05:14 PM
OK, thanks.  I'll open a ticket momentarily.

===== TICKET OPENED # 535329 =======
0
De
Top achievements
Rank 1
answered on 19 Apr 2012, 05:04 AM
Hai Im a new member to this forum just now I had gone through some topics and I came to a conclusion that this is very useful and thank you for all...........

Tags
Templates
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Petyo
Telerik team
De
Top achievements
Rank 1
Share this question
or