如何分组(在之间添加水平线)Kendo DropDownButton 的项目
How to group (add horizontal line between) items of Kendo DropDownButton
我想在 Kendo DropDownButton 的两个项目之间添加 <hr>
。我想我需要类似于 How to add separator to kendo toolbar splitbutton menuitems 的东西,因为所需的功能是相同的。
Html
<kendo-dropdownbutton aria-label="Actions" class="k-button" [disabled]="isLoading" [data]="actionsOptions" (dblclick)="toolBarButtondblclick()" style="padding-bottom: 2px; padding-top: 2px;"><span class="k-icon k-i-grid"></span>{{lbl_Actions}}</kendo-dropdownbutton>
Ts
this.actionsOptions = [
{
text: this.lbl_Copy,
icon: 'copy',
click: () => {
this.copyAPHit();
}
},
{
text: this.lbl_ShowRelations,
icon: 'connector',
click: () => {
this.showRelations();
}
},
{
disabled: (this.segmentsPath !== "APs"),
text: this.lbl_UnSync,
icon: 'non-recurrence',
click: () => {
this.unSync();
}
}
];
因此,我需要在第二项和第三项之间添加一条水平线(分隔)。我怎样才能做到这一点?
我设法使用 HTML 中的 kendoDropDownButtonItemTemplate
解决了它。
<kendo-dropdownbutton aria-label="Actions" class="k-button" [disabled]="isLoading" [data]="actionsOptions" (dblclick)="toolBarButtondblclick()" style="padding-bottom: 2px; padding-top: 2px;">
<span class="k-icon k-i-grid"></span>
{{lbl_Actions}}
<ng-template kendoDropDownButtonItemTemplate let-dataItem>
<div style="width: 100%;">
<span class="k-icon k-i-{{ dataItem.icon }}"></span>
<span>{{ dataItem.text }}</span>
<hr *ngIf="dataItem.last" style="display: block; border: 1px solid #bebebe; margin-top: 0; margin-bottom: 0">
</div>
</ng-template>
TS中的datasource再稍微修改一下:
this.actionsOptions = [
{
text: this.lbl_Copy,
icon: 'copy',
click: () => {
this.copyAPHit();
},
last: true
},
{
text: this.lbl_ShowRelations,
icon: 'connector',
click: () => {
this.showRelations();
}
},
{
disabled: (this.segmentsPath !== "APs"),
text: this.lbl_UnSync,
icon: 'non-recurrence',
click: () => {
this.unSync();
}
}
];
其中 last
用于显示组中的最后一项并创建所需的水平行。
我想在 Kendo DropDownButton 的两个项目之间添加 <hr>
。我想我需要类似于 How to add separator to kendo toolbar splitbutton menuitems 的东西,因为所需的功能是相同的。
Html
<kendo-dropdownbutton aria-label="Actions" class="k-button" [disabled]="isLoading" [data]="actionsOptions" (dblclick)="toolBarButtondblclick()" style="padding-bottom: 2px; padding-top: 2px;"><span class="k-icon k-i-grid"></span>{{lbl_Actions}}</kendo-dropdownbutton>
Ts
this.actionsOptions = [
{
text: this.lbl_Copy,
icon: 'copy',
click: () => {
this.copyAPHit();
}
},
{
text: this.lbl_ShowRelations,
icon: 'connector',
click: () => {
this.showRelations();
}
},
{
disabled: (this.segmentsPath !== "APs"),
text: this.lbl_UnSync,
icon: 'non-recurrence',
click: () => {
this.unSync();
}
}
];
因此,我需要在第二项和第三项之间添加一条水平线(分隔)。我怎样才能做到这一点?
我设法使用 HTML 中的 kendoDropDownButtonItemTemplate
解决了它。
<kendo-dropdownbutton aria-label="Actions" class="k-button" [disabled]="isLoading" [data]="actionsOptions" (dblclick)="toolBarButtondblclick()" style="padding-bottom: 2px; padding-top: 2px;">
<span class="k-icon k-i-grid"></span>
{{lbl_Actions}}
<ng-template kendoDropDownButtonItemTemplate let-dataItem>
<div style="width: 100%;">
<span class="k-icon k-i-{{ dataItem.icon }}"></span>
<span>{{ dataItem.text }}</span>
<hr *ngIf="dataItem.last" style="display: block; border: 1px solid #bebebe; margin-top: 0; margin-bottom: 0">
</div>
</ng-template>
TS中的datasource再稍微修改一下:
this.actionsOptions = [
{
text: this.lbl_Copy,
icon: 'copy',
click: () => {
this.copyAPHit();
},
last: true
},
{
text: this.lbl_ShowRelations,
icon: 'connector',
click: () => {
this.showRelations();
}
},
{
disabled: (this.segmentsPath !== "APs"),
text: this.lbl_UnSync,
icon: 'non-recurrence',
click: () => {
this.unSync();
}
}
];
其中 last
用于显示组中的最后一项并创建所需的水平行。