【发布时间】:2014-07-02 14:15:38
【问题描述】:
我正在处理 DHTMLX 网格,我需要在每一行中添加编辑/删除按钮,有什么方法可以做到。我用谷歌搜索了它,我能够找到关于复选框和链接。
任何帮助将不胜感激。
【问题讨论】:
标签: javascript jquery css json dhtmlx
我正在处理 DHTMLX 网格,我需要在每一行中添加编辑/删除按钮,有什么方法可以做到。我用谷歌搜索了它,我能够找到关于复选框和链接。
任何帮助将不胜感激。
【问题讨论】:
标签: javascript jquery css json dhtmlx
您可以使用任何所需的 html 内容创建自定义列类型。 例如,以下代码将创建一个 eXcell,它将单元格值呈现为带有标签的按钮:
function eXcell_button(cell){ //the eXcell name is defined here
if (cell){ // the default pattern, just copy it
this.cell = cell;
this.grid = this.cell.parentNode.grid;
}
this.edit = function(){} //read-only cell doesn't have edit method
this.isDisabled = function(){ return true; } // the cell is read-only, so it's always in the disabled state
this.setValue=function(val){
this.setCValue("<input type='button' value='"+val+"'>",val);
}
}
eXcell_button.prototype = new eXcell; // nests all other methods from the base class
之后您只需要在网格中设置列类型:
grid.setColTypes("button,...");
在这里您可以找到包含各种示例的详细教程: http://docs.dhtmlx.com/grid__columns_types.html#customeditors
【讨论】: