Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. the template
  2. <script type="text/x-kendo-template" id="templateForCategoryList">
  3. <a href="pgArticles?categoryid=${Id}" >
  4. <img src="${imgPath}" class="publicationImage" />
  5. ${Text}
  6. </a>
  7. </script>
  8.  
  9. the view
  10. <!-- all articles in that publication -->
  11. <div data-role="view" data-layout="main-layout" id="pgArticles"
  12. data-show="loadArticles"
  13. data-title="Articles">
  14. <ul data-role="listview" id="uxArticleList" ></ul>
  15. </div>
  16. the load javascript thing..
  17. function loadArticles(e){
  18.  
  19. var params = e.view.params;
  20. var id = params["categoryid"];
  21. //alert(id);
  22. renderData('articles' , '#uxArticleList', 'templateForArticleList','&categoryid=' + id);
  23.  
  24. }
  25.  
  26. the render method
  27.  
  28. function renderData(type , bindingTarget, idOfemplateToUse,whereClause){
  29. var url = getDataUrlFor(type,true,whereClause);
  30. // alert(url);
  31. var ds = new kendo.data.DataSource.create({
  32. transport: {
  33. // read from the remote data source
  34. read: {
  35. url : url,
  36. type : 'GET',
  37. dataType : 'jsonp',
  38. crossDomain : true
  39. }
  40. }
  41. });
  42.  
  43. // alert ( ds);
  44. $(bindingTarget).kendoMobileListView({
  45. dataSource: ds,
  46. template: kendo.template($(idOfemplateToUse).html())
  47. });
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement