我需要使用开源的KendoUI Grid来显示我的模式列表。但这不是成功。我连接数据库并将数据作为控制器类中的列表。我需要从数据库中获取数据来完成这个网格。如何使用开源Kendo Grid显示数据库表格的网格?
$("#gridd").kendoGrid({
dataSource: {
transport: {
read: {
url: "report/GetData",
type:"json"
}
},
sortable: true,
pageable: {
input: true,
numeric: false
}, height: 430,
selectable: "multiple",
columns: [
{ field: "Users.uName", title: "Kullanıcı", width: "80px" },
{ field: "Locations.locName", title: "Oda", width: "80px" },
{ field: "Devices.devName", title: "Cihaz", width: "80px" },
{ field: "Commands.cName", title: "Komut", width: "80px" },
{ field: "gasValue", title: "Gaz", width: "80px" },
{ field: "tempValue", title: "Sıcaklık", width: "130px" },
{ field: "humValue", title: "Nem", width: "80px" },
{ field: "AlarmCodes.aName", title: "Alarm", width: "80px" },
{ field: "ReasonCodes.rName", title: "Nedeni", width: "80px" }]
}
});
我的控制器类
public JsonResult GetData()
{
var reports = db.ActivityLog.OrderBy(c => c.dateTime).ToList();
return Json(reports, JsonRequestBehavior.AllowGet);
}
编辑我目前的代码。现在我看到了网格,但我看不到里面的数据。他们将如何显示?
它不工作.. –
我必须做的JavaScript命令。是可能的模型连接到JavaScript?因为我不能使用Html.Kendo(),所以会出现语法错误。 –
如果您使用的是Kendo引擎,您是否在“Kendo”之前写过“@”,如果您使用ASP编码,是否写过“%=”......请记住,服务器代码以此字符开头。此外,您必须解决位于模型中的类“位置”中的所有逻辑。 –