Php 未填充简单KendoUI网格
关于这个话题有几个不同的问题,但没有一个答案有用,所以我想我会试试看是否有人能解决这个问题 我有一个简单的网格,下面是HTML/PHP:Php 未填充简单KendoUI网格,php,json,kendo-ui,kendo-grid,Php,Json,Kendo Ui,Kendo Grid,关于这个话题有几个不同的问题,但没有一个答案有用,所以我想我会试试看是否有人能解决这个问题 我有一个简单的网格,下面是HTML/PHP: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo PROPERTY_TITLE; ?></title>
<!-- LOAD KENDO CSS -->
<link rel="stylesheet" type="text/css" href="css/kendo.bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="css/kendo.common.min.css"/>
<link rel="stylesheet" type="text/css" href="css/kendo.default.min.css"/>
<!-- -------------- -->
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="<?php echo BASE_URL; ?>css/style.css" />
<script src="js/jquery.js"> // REQUIRED FOR THIS APPLICATION TO FUNCTION </script>
<!-- LOAD KENDO -->
<script type="text/javascript" src="js/kendo.all.min.js"> // REQUIRED FOR THIS APPLICATION TO FUNCTION </script>
<!-- ---------- -->
</head>
<body class="bg">
<div class="grid-box7 box2close min_height_700" style="display: none;">
<script>
// Function to build the grid
function generateRawDataGrid() {
var from = $("#fromDate").val();
var to = $("#toDate").val();
<? if ( isset($_GET['source']) && is_numeric($_GET['source']) ) { ?>
var source = <? echo trim($_GET['source']); ?>;
<? } else { ?>
var source = '';
<? } ?>
$(".li_current_report").html("Raw Statistical Data");
$("#rawDataGrid").kendoGrid({
columns: [
{ title: "Action",
field: "comment"
}
],
dataSource: {
transport: {
read: {
url: "data/get_stats.php?from=" + from + "&to=" + to + "&source=" + source + "&rt=3"
}
},
schema: {
data: "data"
},
type: "json"
},
pageable: {
refresh: true,
pageSize: 15,
pageSizes: [
15,30,60,100
]
},
sortable: true,
filterable: true,
scrollable: false,
selectable: "row",
reorderable: true
}); // END: Report Grid
} // END: Function generateGrid()
</script>
<div id="rawDataGrid" >
<!-- Grid is here -->
</div>
</div>
</body>
</html>
输出看起来很好——皮棉也很好,这里有一个例子:
{"data":[{"comment":"Site Visit"},{"comment":"Site Visit"},{"comment":"Site Visit"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"Site Visit"},{"comment":"View Contact Information"},{"comment":"Site Visit"},{"comment":"View Contact Information"},{"comment":"Doctor Site Visit"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"Doctor Site Visit"},{"comment":"View Contact Information"},{"comment":"Site Visit"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"View Contact Information"},{"comment":"Doctor Site Visit"},{"comment":"View Contact Information"},{"comment":"Doctor Site Visit"}]}
但是网格没有渲染。我使用了几个JSON验证器。浏览器将此输出视为APPLICATION/JSON
有什么想法吗
提前感谢大家 我看不出您在哪里调用此方法<代码>generateRawDataGrid() 也许您需要创建一个document.ready()函数并从那里调用它
$(document).ready(function () {
generateRawDataGrid();
});
我看不出你在哪里调用这个方法。generateRawDataGrid()您是对的。。那密码里没有。在我创建的新页面中有一个错误,我复制并粘贴了一个错误的8/。也就是说,我找到了。对该方法的调用只有“generateRawData()”。天哪。。有时只需要另一双眼睛。谢谢你,瑞克@里克斯把你的评论写在回信里,我会接受的。再次感谢。
$(document).ready(function () {
generateRawDataGrid();
});