我的SlickGrid在我的页面上没有显示任何数据。如果我检查控制台,结果将被填充。网格显示列的标题。任何人都知道为什么没有数据? 看起来我和example中的做法相同。
var grid;
var columns = [
{ id: "BO", name: "BO", field: "BO" }, ....
];
var options = {
enableCellNavigation: true,
enableColumnReorder: false
};
$(function ()
$.ajax({
url: "DataService.svc/DoWork",
type: "POST",
contentType: "application/json",
dataType: 'json',
success: loadData,
error: function(jqXHR, exception) {
alert(jqXHR.responseText);
}
});
});
function loadData(result) {
console.log(result);
grid = new Slick.Grid("#myGrid", result, columns, options);
}
HTML:
<asp:Content ID="Content1" ContentPlaceHolderID="Title" runat="server">
<link href="Content/slick.grid.css" rel="stylesheet" />
<script src="Scripts/jquery-1.7.2.min.js"></script>
<script src="Scripts/jquery.event.drag.js"></script>
<script src="Scripts/SlickGrid/slick.core.js"></script>
<script src="Scripts/SlickGrid/slick.grid.js"></script>
<script src="Scripts/EditFeed.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentHolder" runat="server">
<div id="myGrid" style="width:1200px;height:500px;"></div>
</asp:Content>
{
编辑:
答案 0 :(得分:0)
function loadData(result) {
console.log(result);
grid = new Slick.Grid("#myGrid", result.d, columns, options);
}
如果选择result.d,您将获得光滑网格接受的对象。