Advertisement
Guest User

Untitled

a guest
Aug 25th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <title>Students</title>
  5.      <link href="Styles/kendo.common.min.css" rel="stylesheet" />
  6.     <link href="Styles/kendo.default.min.css" rel="stylesheet" />
  7.     <script src="Scripts/jquery.min.js"></script>
  8.     <script src="Scripts/kendo.all.min.js"></script>
  9. </head>
  10. <body>
  11.     <script id="template" type="text/x-kendo-template">
  12.                 <div class="person-item" id="#= id #">
  13.                  <strong class="person-name">#= name #</strong><p class="person-grade">Grade: #= grade #</p>
  14.                 </div>
  15.     </script>
  16.     <div id="combobox"></div>
  17.     <div id="marks-box"></div>
  18.     <script>
  19.         $("#combobox").kendoDropDownList({
  20.             dataSource: {
  21.                 transport: {
  22.                     read: {
  23.                         dataType: "json",
  24.                         url: "http://localhost:53368/api/students"
  25.                     }
  26.                 }
  27.             },
  28.             dataTextField: "name",
  29.             dataValueField: "id",
  30.             change: function (e) {
  31.                 e.preventDefault();
  32.                 $(".k-list-container").on("click", 'li.k-item', function() {
  33.                     var childOfLi = $(this).find('div:first').attr('id');
  34.                     var id = parseInt(childOfLi);
  35.                     if (id > 0) {
  36.                         $("#marks-box").kendoGrid({
  37.                             dataSource: {
  38.                                 transport: {
  39.                                     read: {
  40.                                         dataType: "json",
  41.                                         url: "http://localhost:53368/api/students/" + id + "/marks"
  42.                                     }
  43.                                 }
  44.                             },
  45.                             dataTextField: "subject",
  46.                             dataValueField: "score"
  47.                         });
  48.                     }
  49.                 });
  50.             },
  51.             template: kendo.template($("#template").html())
  52.         });
  53.     </script>
  54.     <style>
  55.         #marks-box {
  56.             margin-top: 10px;
  57.             width: 200px;
  58.             min-height: 200px;
  59.         }
  60.     </style>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement