为什么数据不会显示在kendo ui网格上

时间:2017-09-21 02:59:48

标签: javascript html kendo-ui-grid

我有鳕鱼如下



var loadGridEmployee = function(listEmployee) {
var grid = $("#grdemployees").data("kendoGrid");
	if (!grid) {
		grid = $("#grdemployees").kendoGrid({
	        height: 600,
	        columns: [
	            { field: "ID", title:"ID", width: "100px" },
	            { field: "Name", title:"Name", width: "150px"},
	            { field: "Phone", title: "Phone", width: "150px"}              
	        ],
	        sortable: true,
	        resizable: true,
			selectable: true,
	        
	        pageable: {
	            pageSize: 20,
	            messages: {
	                display: "{0}-{1} \/ {2}"
	            }
	        },
	        noRecords: {
	            template:"xx" + ": List is empty"
	        }
	    }).data("kendoGrid");
	}
	grid.dataSource.data(listEmployee);
	
	return grid;
	
}
$(document).ready(function () {
	
  var grid = loadGridEmployee(listEmployee);
	
})

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2016.2.714/js/jquery.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2016.2.714/js/kendo.all.min.js"></script>
<script type="text/javascript">
var listEmployee = = [{"id":1,"name":"Dang Quang Hai","phone":"34563653434"}, {"id":2,"name":"Dang Gia Huy","phone":"78568534r234"}, {"id":3,"name":"Dang Hoang Linh Chi","phone":"56745745"}, {"id":4,"name":"tran binh trong","phone":"23234234r"}, {"id":5,"name":"Quang Tèo","phone":"123"}, {"id":6,"name":"hihihihih","phone":"31241"}];

</script>
<title>Insert title here</title>
</head>
<body>
<div id="grdemployees"></div>
<h1>Test list</h1>
</body>
</html>
&#13;
&#13;
&#13;

我不知道为什么数据没有出现在网格上。 结果我收到了网格列的一些标题,如下图所示。 enter image description here 请帮我 我完全满足了我的需要为什么STACKOVER不同意发布这个问题?

1 个答案:

答案 0 :(得分:0)

抱歉全部,

我发现了自己的错误。字段的名称必须是这样的 ID-&gt; id,名称 - &gt;名称,电话 - &gt;电话。因为我的表在数据库中。