【发布时间】:2017-06-15 23:34:13
【问题描述】:
我将剑道网格嵌套在另一个剑道网格行中,作为“详细信息”模板。不过,我遇到了这个非常令人沮丧的问题; Kendo 似乎正在为我自动生成详细信息网格的列,即使我自己定义了它们并且它显示了很多我不想显示的列。
这是原始网格:
$("#ResellerBillingGrid").kendoGrid({
dataSource: viewModel.resellerDataSource,
editable: false,
groupable: false,
sortable: true,
pageable: true,
scrollable: false,
filterable: {
extra: false,
messages: {
isTrue: "Yes",
isFalse: "No",
info: " "
}
},
filterMenuInit: filterMenuInit,
detailTemplate: kendo.template($("#resellerDetailTemplate").html()),
detailInit: viewModel.detailInit,
columns: [
{ field: "DisplayName", title: "Reseller" }
]
});
这是我的视图模型以及网格细节:
var viewModel = new kendo.observable({
resellerDataSource: new kendo.data.DataSource({
transport: {
read: {
url: "/Host/Billing/GetResellers",
dataType: "json",
type: "GET"
}
},
pageSize: 20,
schema: {
model: {
fields: {
DisplayName: { type: "string" },
ResellerOrganizationsDataSource: [
{
Id: { type: "number" },
OrgDisplay: { type: "string" },
UserCount: { type: "number" },
PricingTier: {
Id: { type: "number" },
Name: { type: "string" },
PricePerUser: { type: "number" },
Total: { type: "number" }
}
}
]
}
}
}),
detailInit: function (e) {
var detailRow = e.detailRow;
detailRow.find(".resellerOrgsGrid").kendoGrid({
dataSource: {
data: e.data.ResellerOrganizationsDataSource,
pageSize: 10,
schema: {
model: {
fields: {
Id: { type: "number" },
OrgDisplay: { type: "string" },
UserCount: { type: "number" },
PricingTier: {
Id: { type: "number" },
Name: { type: "string" },
PricePerUser: { type: "number" },
Total: { type: "number" }
}
}
}
}
},
scrollable: false,
sortable: true,
pageable: true,
columns: [
{ field: "OrgDisplay", filterable: { ui: orgFilter }, title: "Name" },
{ field: "PricingTier.Name, title: "Pricing Tier", filterable: { ui: tierFilter } ),
{ field: "PricingTier.PricePerUser", title: "Price Per User", format: "{0:C2}" },
{ field: "UserCount", title: "Total Users" },
{ field: "PricingTier.Total", title: "Total", format: "{0:C2}" }
]
}
});
}
});
现在最疯狂的是,即使我从detail 网格中删除列定义,所有“自动生成”列仍然存在。
这是我得到的屏幕截图 - 请注意即使只定义了 5 列,该行的详细信息中的所有列也是如何显示的:
之前有没有人遇到过这个问题,或者对导致这个问题的原因有任何想法?
【问题讨论】:
标签: javascript mvvm kendo-ui kendo-grid