gpt4 book ai didi

Webix 数据表单元格内的按钮

转载 作者:行者123 更新时间:2023-12-02 09:48:17 25 4
gpt4 key购买 nike

我需要在 Webix 数据表中创建一列按钮。我可以自定义一个简单的 html 按钮,如下所示:

webix.ui({
view:"datatable",
columns:[
. . .
{ id: "button1",
template: "<button class='custom_css'>Click Me!</button>",
width:70 }
],
onClick:{
button1: function(ev, id){
. . .
}
}
});

但毕竟没有我想要的那么方便。

我想知道是否还有其他方法可以做到这一点?

最佳答案

您可以将按钮定义为事件元素。它为您提供全功能按钮,无需任何 html 首选项如下:

  1. 通过其名称将 ActiveContent 模块添加到 View

    webix.protoUI({ name:'activeTable'}, webix.ui.datatable, webix.ActiveContent );
  2. 定义您的按钮:

    webix.ui({
    id:'table1',
    view:"activeTable",
    data:grid_data,
    columns:[
    . . .
    { id: "button", template: "{common.yourButton()}" }
    ],

    activeContent: {
    yourButton: {
    id:"button1",
    view:"button",
    label:"Click",
    width: 70,
    height:30,
    click:function(id, e){ . . . }
    },
    },

    });

您可以检查代码片段: http://webix.com/snippet/3539bb9a

关于Webix 数据表单元格内的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33611673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com