【问题标题】:Kendo UI react tree view add action buttons to each nodeKendo UI 反应树视图向每个节点添加操作按钮
【发布时间】:2018-10-25 19:47:25
【问题描述】:

我想在 kendo ui 树视图中的每个节点的下拉菜单中添加操作按钮以进行反应。 https://www.telerik.com/kendo-react-ui/wrappers/treeview/

例如:

但是,我们希望显示“...”而不是删除图标,当用户单击这三个点时,会显示一个包含多个操作的下拉菜单(我不想要上下文菜单) (创建、更新、删除)应该会出现。

在 Kendo UI for jQuery 中使用模板 (https://demos.telerik.com/kendo-ui/treeview/templates) 解决了这个问题。我不知道如何通过反应来实现这一点。非常感谢任何帮助。

谢谢!

【问题讨论】:

    标签: reactjs kendo-ui kendo-treeview


    【解决方案1】:

    在 React TreeView 中可以使用相同的模板:

    树视图:

    <TreeView dataSource={this.dataSource} template={kendo.template($("#treeview-template").html())}/>
    

    模板是一个 HTML 元素,必须放在 HTML 文件中,例如 index.html:

        <script id="treeview-template" type="text/kendo-ui-template">
            #: item.text #
            # if (!item.items) { #
                <a class='k-icon k-i-close-outline' href='\#'></a>
            # } #
        </script>
    

    【讨论】:

    • 好的。我应该把这个脚本标签放在反应组件中吗?
    • 可以放在index.html文件中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多