是否可以在webix数据表中生成可编辑的列标题?此代码将允许编辑表中的数据,但不允许编辑标题本身:
webix.ui({
view:"datatable",
editable:true,
columns:[
{ id:"title", header:"Test", fillspace:true, editor:"text"}],
data:[
{title:"random"}
]
});发布于 2016-10-03 10:41:07
没有内置的解决方案,但是添加外部编辑器非常容易。
http://webix.com/snippet/379ee39b
您可以创建一个单独的弹出窗口,其中包含文本编辑器。
webix.ui({ id:"editor", view:"popup", body:{
view:"form",
elements:[
{ view:"text", name:"header" },
{ view:"button", value:"Save", click:function(){
var top = this.getTopParentView();
top.config.callback( top.getBody().getValues().header);
top.hide();
}}
]
}});稍后,从头单击事件使用它。
onHeaderClick:function(id, ev){
var grid = this;
$$("editor").getBody().setValues({
header: this.getColumnConfig(id.column).header[0].text
});
$$("editor").config.callback = function(value){
grid.getColumnConfig(id.column).header[0].text = value;
grid.refreshColumns();
};
$$("editor").show(ev);
$$("editor").getBody().focus();
}https://stackoverflow.com/questions/39801285
复制相似问题