帮我修复两天前运行完美的代码。我不知道我有什么想法,但现在,网格只是空的,你能帮我一些忙吗?请。
$("#grid").kendoGrid({
sortable: true,
groupable: true,
scrollable: true,
height: "300px",
pageable: {
pageSizes: 9
},
dataSource: {
transport: {
read: {
url: "http://localhost/pharmacypoints/api/Productos/getSinFiltro",
dataType: "Json"
}
}
},
Columns: [
{ field: "Codigo",
tittle: "Codigo"
},
{ field: "Descripcion",
tittle: "Descripcion"
},
{ field: "Familia",
tittle: "Familia"
},
{ field: "Laboratorio",
title: "Laboratorio"
},
{ field: "Clasificacion",
tittle: "Clasificacion"
}]
});
数据库结果如下:
[{"Codigo":"6140","Producto":"CIPROXINA FA 200ML 400MG","Familia":"ANTIBIOTICO 10","Clasificacion":"CONTROLADOS","Laboratorio":"BAYER DE MEXICO, SA DE CV"}, and more objects
答案 0 :(得分:2)
两个小问题:
Columns
必须为小写。title
而不是tittle
。试试这个:
$("#grid").kendoGrid({
sortable : true,
groupable : true,
scrollable: true,
height : "300px",
pageable : {
pageSizes: 9
},
dataSource: {
transport: {
read: {
url : "http://localhost/pharmacypoints/api/Productos/getSinFiltro",
dataType: "Json"
}
}
},
columns : [
{ field: "Codigo", title: "Codigo" },
{ field: "Descripcion", title: "Descripcion" },
{ field: "Familia", title: "Familia" },
{ field: "Laboratorio", title: "Laboratorio" },
{ field: "Clasificacion", title: "Clasificacion" }
]
});