kendoGrid jquery 数据列表加载



$(document).ready(function() {
002.      var $grid = $("#samples-all").kendoGrid({
003.          dataSource: {
004.              transport: {
005.                  read: "/uploads/",
006.                  dataType: "json",
007.                  create: {
008.                    /* don't cache grid items, otherwise miss new uploads */
009.                    cache: false
010.                  }
011.              },
012.              schema: {
013.                  data: "rows",
014.                  total: "totalRows"
015.              },
016.              pageSize: 20,
017.              serverPaging: true,
018.              serverFiltering: true
019.          },
020.          pageable: true,
021.          scrollable: false,
022.          filterable: {
023.              extra: false,
024.              operators: {
025.                  string: {
026.                      eq: "Is equal to",
027.                      neq: "Is not equal to"
028.                  }
029.              }
030.          },
031.          columns: [
032.              {
033.                  field: "threat_presence",
034.                  title: " ",
035.                  template: kendo.template($("#tp-template").html(), { useWithBlock: false }),
036.                  width: 29,
037.                  filterable: {
038.                      ui: threatFilter
039.                  }
040.              },
041.              {
042.                  field: "file_name",
043.                  title: "Name",
044.                  template: kendo.template($("#file-name-template").html(), { useWithBlock:false }),
045.                  width: 250,
046.                  filterable: false
047.              },
048.              {
049.                  field: "file_type",
050.                  title: "Type",
051.                  filterable: false
052.              },
053.              {
054.                  field: "file_count",
055.                  title: "File Count",
056.                  width: 55,
057.                  filterable: false
058.              },
059.              {
060.                  field: "sha1",
061.                  title: "SHA1",
062.                  width: 250,
063.                  filterable: false
064.              },
065.              {
066.                  field: "message",
067.                  title: "Status",
068.                  width: 70,
069.                  filterable: false
070.              },
071.              {
072.                  field: "inserted",
073.                  title: "First Seen",
074.                  filterable: false
075.              },
076.              { command: { text: "Download", click: download }, title: " ", width: "85px" }
077.          ]
078.      }).data("kendoGrid");
079.      // setup the upload window and toolbar button
080.      var $uploadWindow = $("#uploadWindow"),
081.          $btnUpload = $("#btnUpload").on("click"function() {
082.              $uploadWindow.data("kendoWindow").open();
083.          });
084.  
085.      if (!$uploadWindow.data("kendoWindow")) {
086.          $uploadWindow.kendoWindow({
087.              width: "400px",
088.              title: "Upload",
089.              visible: false
090.          });
091.      }
092.      $("#upload-file").kendoUpload({
093.          async: {
094.              saveUrl: "/upload-samples/",
095.              removeUrl: "remove",
096.              autoUpload: false
097.          },
098.          upload: onUpload,
099.          success: onUploadSuccess,
100.          complete: onUploadComplete
101.      });
102.       
103.      function onUpload(e) {
104.          // omitted
105.      }
106.      function onUploadSuccess(e) {
107.          // omitted
108.      }
109.      function onUploadComplete(e) {
110.          console.log(e);
111.          var grid = $("#samples-all").data("kendoGrid");
112.          grid.dataSource.read();
113.          grid.refresh();
114.      }
115. });
html:
<div id="samples-list-container">
     <div id="samples-all"></div>
</div>
$(document).ready(function() {
002.      var $grid = $("#samples-all").kendoGrid({
003.          dataSource: {
004.              transport: {
005.                  read: "/uploads/",
006.                  dataType: "json",
007.                  create: {
008.                    /* don't cache grid items, otherwise miss new uploads */
009.                    cache: false
010.                  }
011.              },
012.              schema: {
013.                  data: "rows",
014.                  total: "totalRows"
015.              },
016.              pageSize: 20,
017.              serverPaging: true,
018.              serverFiltering: true
019.          },
020.          pageable: true,
021.          scrollable: false,
022.          filterable: {
023.              extra: false,
024.              operators: {
025.                  string: {
026.                      eq: "Is equal to",
027.                      neq: "Is not equal to"
028.                  }
029.              }
030.          },
031.          columns: [
032.              {
033.                  field: "threat_presence",
034.                  title: " ",
035.                  template: kendo.template($("#tp-template").html(), { useWithBlock: false }),
036.                  width: 29,
037.                  filterable: {
038.                      ui: threatFilter
039.                  }
040.              },
041.              {
042.                  field: "file_name",
043.                  title: "Name",
044.                  template: kendo.template($("#file-name-template").html(), { useWithBlock:false }),
045.                  width: 250,
046.                  filterable: false
047.              },
048.              {
049.                  field: "file_type",
050.                  title: "Type",
051.                  filterable: false
052.              },
053.              {
054.                  field: "file_count",
055.                  title: "File Count",
056.                  width: 55,
057.                  filterable: false
058.              },
059.              {
060.                  field: "sha1",
061.                  title: "SHA1",
062.                  width: 250,
063.                  filterable: false
064.              },
065.              {
066.                  field: "message",
067.                  title: "Status",
068.                  width: 70,
069.                  filterable: false
070.              },
071.              {
072.                  field: "inserted",
073.                  title: "First Seen",
074.                  filterable: false
075.              },
076.              { command: { text: "Download", click: download }, title: " ", width: "85px" }
077.          ]
078.      }).data("kendoGrid");
079.      // setup the upload window and toolbar button
080.      var $uploadWindow = $("#uploadWindow"),
081.          $btnUpload = $("#btnUpload").on("click"function() {
082.              $uploadWindow.data("kendoWindow").open();
083.          });
084.  
085.      if (!$uploadWindow.data("kendoWindow")) {
086.          $uploadWindow.kendoWindow({
087.              width: "400px",
088.              title: "Upload",
089.              visible: false
090.          });
091.      }
092.      $("#upload-file").kendoUpload({
093.          async: {
094.              saveUrl: "/upload-samples/",
095.              removeUrl: "remove",
096.              autoUpload: false
097.          },
098.          upload: onUpload,
099.          success: onUploadSuccess,
100.          complete: onUploadComplete
101.      });
102.       
103.      function onUpload(e) {
104.          // omitted
105.      }
106.      function onUploadSuccess(e) {
107.          // omitted
108.      }
109.      function onUploadComplete(e) {
110.          console.log(e);
111.          var grid = $("#samples-all").data("kendoGrid");
112.          grid.dataSource.read();
113.          grid.refresh();
114.      }
115. });
html:
<div id="samples-list-container">
     <div id="samples-all"></div>
</div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值