【问题标题】:In the kendo-multiselect how to Show "+" icon to add a field在 kendo-multiselect 如何显示“+”图标添加字段
【发布时间】:2019-07-22 02:07:42
【问题描述】:

在我的 Angular 应用程序中,我使用的是 kendo-multiselect。我想要实现的是:

从下拉列表中选择一个值,然后单击 kendo-multiselect 上的 + 图标,然后打开一个新页面(基于下拉值)。

我已使用 [clearButton]="false" 从多选中删除了默认的 x 图标,但我无法弄清楚如何在同一位置显示 + 图标!

【问题讨论】:

    标签: angular kendo-ui


    【解决方案1】:

    您可以在<kendo-multiselect> 中使用<ng-template kendoMultiSelectGroupTagTemplate let-dataItems>

    HTML:

    <kendo-multiselect
    kendoMultiSelectSummaryTag
    [data]="data"
    [filterable]="true"
    [textField]="textField"
    [valueField]="valueField"
    [clearButton]="false"
    [autoClose]="false"
    [value]="selectedValue">
      <ng-template kendoMultiSelectGroupTagTemplate let-dataItems>
        <i class="fas fa-plus-circle fa-lg" (click)="redirectPage(selectedValue)"></i>
      </ng-template>
    </kendo-multiselect>
    

    TS:

    /** 
     * redirectPage() method is used to redirect into a new component on click of + icon.
     * @param selectedValue {object} - Object of the selected option from the dropdown.
     */
    redirectPage(selectedValue) {
      // redirection logic will come here.
    }
    

    【讨论】:

    • 我试过了,但这将对多选字段中的所有元素应用 +,我只想要一个在最右边的角落!
    • 它只会在右上角显示一个来代替关闭图标。您能在 stalkblitz 中分享您的工作代码吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    相关资源
    最近更新 更多