我想在 Kendo UI 组合框中对项目进行分组。
我的数据源是 -
$("#ddlTest_I").kendoComboBox({
dataTextField: "parentName",
dataValueField: "parentId",
dataSource: [
{ parentName: "Parent1", parentId: 1, childName: "Child1", childId: 1 },
{ parentName: "Parent2", parentId: 2, childName: "Child2", childId: 2 },
{ parentName: "Parent1", parentId: 1, childName: "Child3", childId: 3 },
{ parentName: "Parent2", parentId: 2, childName: "Child4", childId: 4 },
{ parentName: "Parent1", parentId: 1, childName: "Child5", childId: 5 }
]
});
我尝试将数据绑定到 Kendo UI 组合框 -
$("#ddlTest_II").kendoComboBox({
cascadeFrom: "ddlTest_I",
dataTextField: "childName",
dataValueField: "childId",
dataSource: [
{parentName: "Parent1", parentId: 1, childName: "Child1", childId: 1 },
{ parentName: "Parent2", parentId: 2, childName: "Child2", childId: 2 },
{ parentName: "Parent1", parentId: 1, childName: "Child3", childId: 3 },
{ parentName: "Parent2", parentId: 2, childName: "Child4", childId: 4 },
{ parentName: "Parent1", parentId: 1, childName: "Child5", childId: 5 }
]
});
我想使用 KendoUI 组合框 cascadeFrom 格式。但项目在父项是重复的。
这是示例。我不想两次从数据库中提取数据。我将所有数据收集在一个来源中以供使用。