我希望在detailRow中添加一行,以显示行上方的完整描述。
但由于某些原因,当我单击主行中的展开或折叠指示符时,它会生成不需要的重复详细信息行。请建议如何解决此问题。我不确定,我在哪里弄错了或遗失了什么。虽然这两个功能在添加& amp;和删除额外的行元素。但不确定,为什么细节行会一次又一次地添加。
在firebug中调试期间,我发现每次单击展开或折叠图标时,函数“detailInitfunc”都会获得命中。我猜这会在每个动作上创建多个细节行。
Kendo UI dojo链接 - dojo.telerik.com/@maximus392/iSiyU
这两个功能都出现在本文末尾。
$("#gridAudit").kendoGrid({
dataSource: {
data: partnergroups,
schema: {
model: {
fields: {
PartnerGroupID : {type: "number"},
PartnerName: { type: "string" },
PartnerDescription: { type: "string" },
AcquisitionPrice: { type: "number" }
}
}
},
pageSize: 10,
sort: { field: "PartnerName", dir: "asc" }
},
height: 250,
scrollable: true,
sortable: true,
filterable: true,
detailInit: detailInitfunc,
detailCollapse: detailCollapsefunc,
detailExpand: detailExpandfunc,
pageable: {
input: true,
numeric: true
},
columns: [
{ field: "PartnerName", title: "Partner Name", width: "150px" },
{ field: "PartnerDescription", title: "Partner Desc", width: "150px" },
{ field: "Units", title: "Units", format:"{0:##,#;(##,#)}", width: "80px" },
{ field: "AcquisitionPrice", title: "Acquisition Price", format: "{0:c}", width: "120px" }
]
}); //E.O. "kendoGrid" initialization
function detailCollapsefunc(e) { $(e.masterRow).parent().find(".trchd").remove();
}
function detailExpandfunc(e) {
$("<tr class='trchd' style='text-align:center;'><td colspan='10'><b>Group History</b></td></tr>").insertBefore(e.detailRow);
}
function detailInitfunc(e) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
data: childgroups,
filter: { field: "PartnerGroupID", operator: "eq", value: e.data.PartnerGroupID }
},
scrollable: false,
sortable: false,
pageable: false,
columns: [
{ field: "PartnerName", title: "Partner Name", width: "150px" },
{ field: "PartnerDescription", title: "Partner Desc", width: "150px" },
{ field: "Units", title: "Units", format: "{0:##,#;(##,#)}", width: "80px" },
{ field: "AcquisitionPrice", title: "Acquisition Price", format: "{0:c}", width: "120px" }
]
});
} //E.O. "detailInitfunc"