我正在另一个剑道网格行中嵌入一个剑道网格作为"详细信息"模板。不过,我有这个非常令人沮丧的问题;剑道似乎是为我自动生成详细网格的列,即使我自己定义了它们并且它显示了很多我不想要显示的列。
这是原始网格:
$("#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" }
]
});
这是我的viewmodel以及网格细节:
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个行,详细信息中的所有列都会显示:
之前有没有人遇到过这个问题,或者对可能导致这个问题的想法有任何想法?
答案 0 :(得分:0)
我明白了。问题是我在DataSource
内部 而不是在其外部定义了网格的列和其他属性。现在一切正常。