kendo ui之grid列表

本文介绍如何使用 Kendo UI 的 Grid 组件展示数据。通过 JavaScript 初始化 Grid,并配置数据源及列信息。实现包括服务器端分页、排序等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.test_grid.jsp

<html>
<head>
  <%@ include file="/WEB-INF/jsp/common/top.jsp"%>
  <meta http-equiv="Content-Type" content="text/html;">
  <link href="<%=path%>/staticresources/css/test/test_grid.css" rel="stylesheet">
  <script type="text/javascript" src="<%=path%>/staticresource/js/test/test_grid.js"></script>
</head>
<body>
  <
div id="grid"></div>
</body>
</html>

2.test_grid.js$(document).ready(function() {rgs=$("#target").val();

    createGrid(args);
});
function createGrid(value){
     var dataSource=new kendo.data.DataSource({
     transport:{
           read:{
                type:"post",
                url:   path+"^_^";
                contentType:"application/json;"
                dataType:"json"
    },    
    parameterMap:function(options,operation){
       if(operation=="read"){
             if(value!='null'&&value!=undefined&&value!='')
                options['^*^']=value;
             }
             return json.stringify(options);
       }
    }, 
    pagesize:^_^,
    schema:{
        data : function(d) {
          return d.data;
        },
        total : function(d) {
          return d.total;
        },
        model : {
        id : "id",
        fields : {
                 text : {
                 type : "string"
                 }
                }
        }
}, serverPaging:
true, serverFiltering:false, serverSorting:false, change:function(){ (#_#); } }); $("#grid").kendoGrid({ dataSource : dataSource, sortable : true, selectable : "row", change : function() { (#_#); }, pageable : { refresh : true, pageSizes : true }, columns : [{
hidden : true,
     field : "id",
       title : "id",
},{
       field : "text",
title : text,
           }],
        toolbar : [ {
            template :        kendo.template($("#toolBarTemplate").html())
        } ],
        cancel : function(e) {
            e.preventDefault();
        }
    });
}                

 

转载于:https://www.cnblogs.com/liuxing0705/p/3461992.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值