简体   繁体   English

cell.edit 不起作用(制表器 Node.js)

[英]cell.edit doesn't work (Tabulator Node.js)

I got a strange problem: method "cell.edit()" doesn't work (an error "Uncaught TypeError: e.column.modules.edit is undefined" ), however at the same time all other methods works perfectly (eg cell.getField(); cell.getValue()).我遇到了一个奇怪的问题:方法“cell.edit()”不起作用(错误“Uncaught TypeError: e.column.modules.edit is undefined” ),但同时所有其他方法都可以完美运行(例如 cell .getField(); cell.getValue())。 Why could this happen?为什么会发生这种情况?

My code:我的代码:

var table = new Tabulator("#grid1", {
        data:dannyje_iz_json, //assign data to table
        layout:"fitColumns", //fit columns to width of table (optional)
        rowContextMenu: rowMenu, //add context menu to rows
        columns:[ //Define Table Columns
            {title:"ID", field:"id"},
            {title:"Имя", field:"name", cellDblClick:function(e, cell){
                cell.edit(true); //works fine if change this to alert(cell.getField()); alert(cell.getValue());
                //now it leads to the error Uncaught TypeError: e.column.modules.edit is undefined
            }},
            {title:"Возраст", field:"age"},
        ],
    });

Thanks in advance.提前致谢。

You have no editor defined on your column so it is not possible to call edit on it.您的列上没有定义编辑器,因此无法对其调用编辑。 Also there is no point calling edit in the double click event, it will be trigged on click as standard.在双击事件中调用编辑也没有意义,它会在点击时被触发作为标准。

So yuo would be looking at something like this for the column definition:所以你会为列定义寻找类似的东西:

{title:"Имя", field:"name", editor:"input"},

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM