[英]Kendo Grid not displaying all data /columns
I am trying to populate this kendo grid but I am running into some issues.我正在尝试填充此剑道网格,但遇到了一些问题。 When I give titles to the columns, some of the columns are empty but the data is there since I can see when I am printing it in console log.
当我给列标题时,有些列是空的,但数据在那里,因为我可以在控制台日志中看到它的打印时间。
$(function () {
$("#uploadBtn").click(function () {
var url = window.rootUrl + 'Upload/UploadM';
var fileUpload = $("#fileID").get(0);
var files = fileUpload.files;
var data = new FormData();
data.append(files[0].name, files[0]);
$.ajax({
url: url,
type: "POST",
contentType: false, // Not to set any content header
processData: false, // Not to process data
data: data
}).done(function (res) {
console.log("dataTable", res)
$('#AttachGrid').empty();
$("#AttachGrid").kendoGrid({
columns: [
{ field: "DATA_CATEGORY_QOS_CODE", title: "QOS" },
{ field: "DOWNLOAD_SPEED_CLASS_CODE", title: "download" },
{ field: "OPERATOR_OBJECTID", title: "operator" },
{ field: "SETTLEMENT_CODE", title: "settlement" },
{ field: "SHAPE", title: "shape" },
{ field: "TECHNOLOGY_CODE", title: "tech" },
{ field: "UPLOAD_SPEED_CLASS_CODE", title: "upload" },
{ field: "Message", title: "message" }
],
dataSource: res.Data
});
})
});
});
this is what the table looks like with this code这就是使用此代码的表格的样子
so the data is there but it's not populating the kendo grid correctly.所以数据在那里,但它没有正确填充剑道网格。 However, is I do it like this without the columns property, it loads the entire data in the kendo grid.
但是,我是否在没有列属性的情况下这样做,它会将整个数据加载到剑道网格中。
$.ajax({
url: url,
type: "POST",
contentType: false, // Not to set any content header
processData: false, // Not to process data
data: data
}).done(function (res) {
console.log("dataTable", res)
$('#AttachGrid').empty();
$("#AttachGrid").kendoGrid({
dataSource: res.Data
});
})
I can't add custom column titles like this.
我不能像这样添加自定义列标题。 What could the issue be?
可能是什么问题?
It's obvious..... Your json Data
's property names do not match columns field.很明显.....您的 json
Data
的属性名称与列字段不匹配。
Json is DATA_CATEGORY_QOS_OBJECTID
but field is DATA_CATEGORY_QOS_CODE
, so kendo ui will not match correctly........ Json 是
DATA_CATEGORY_QOS_OBJECTID
但字段是DATA_CATEGORY_QOS_CODE
,所以剑道 ui 将无法正确匹配......
Other property/field is the same problem~其他属性/字段也是同样的问题~
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.