简体   繁体   English

有什么方法可以在DHTMLX网格的每一行中添加编辑/删除按钮吗?

[英]Is there any way to add edit/delete button in each row for DHTMLX grid?

I am working on DHTMLX grid and i need to add edit/delete button in each row, Is there any way to do it. 我正在DHTMLX网格上工作,我需要在每一行中添加编辑/删除按钮,有没有办法做到这一点。 I googled it and i was able to find about check box and link. 我用谷歌搜索,我能够找到有关复选框和链接。

Any help will be much appreciated. 任何帮助都感激不尽。

You can create a custom column type with any needed html-content. 您可以使用任何所需的html内容创建自定义列类型。 For example, the following code will create an eXcell which will render the cell value as a button with a label: 例如,以下代码将创建一个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

all you need after that is to set your column type in your grid: 之后,您所需要做的就是在网格中设置列类型:

grid.setColTypes("button,...");

Here you can find a detailed tutorial with various examples: http://docs.dhtmlx.com/grid__columns_types.html#customeditors 在这里,您可以找到带有各种示例的详细教程: http : //docs.dhtmlx.com/grid__columns_types.html#customeditors

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 javascript/jquery 在每一行中添加编辑和删除按钮 - How to add Edit and delete button in each row using javascript/jquery 在表格行的末尾添加编辑/删除按钮 - Add edit/delete button at the end of the table row dhtmlx网格-添加新行并在单元格编辑器上开始 - dhtmlx grid - add new row and start on cell editor Extjs 3.4将按钮(编辑,删除)添加到网格行 - Extjs 3.4 add buttons (Edit, Delete) to the grid row 如何在数据表的每一行中添加编辑/删除按钮 - how to add edit/delete buttons in each row of datatable 我如何在每一行上添加删除按钮? - How Can i add Delete button on each row pls? 将删除按钮内的删除事件添加到 Angular 上的每一行数据表中,并将背景颜色添加到按钮中 - Add delete event inside delete button to each row of Datatables on Angular and add background-color into button 如何使用网格行内的按钮编辑/删除网格模型中的行? - How to edit / delete a row in a grid model using a button inside the gird rows? 有什么办法可以添加 <td> 使用javascript访问每个表格行 - Is there any way to add a <td> to each table row using javascript Syncfusion - 使用我自己的添加/编辑/删除按钮而不是 Syncfusion 在网格中提供的工具栏 - Syncfusion - Using my own Add/Edit/Delete button instead of Syncfusion provided Toolbar within Grid
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM