Javascript 编辑器错误-未找到此类编辑器:制表器代码中的dateEditor
我正在使用ember js中的制表器代码来构建可编辑表。 这里我需要一个日期(--Editable data)的格式化程序,根据我尝试过的Tabletor api中给出的示例,这里我得到了编辑器错误-没有找到这样的编辑器:dateEditor 我在运行时为列指定dateEditor,如下所示。 我也尝试过这样的编辑器:“dateEditor(cell,onRendered,success,cancel)”得到同样的错误Javascript 编辑器错误-未找到此类编辑器:制表器代码中的dateEditor,javascript,ember.js,tabulator,Javascript,Ember.js,Tabulator,我正在使用ember js中的制表器代码来构建可编辑表。 这里我需要一个日期(--Editable data)的格式化程序,根据我尝试过的Tabletor api中给出的示例,这里我得到了编辑器错误-没有找到这样的编辑器:dateEditor 我在运行时为列指定dateEditor,如下所示。 我也尝试过这样的编辑器:“dateEditor(cell,onRendered,success,cancel)”得到同样的错误 columnMap = { align: "center", edito
columnMap =
{
align: "center", editor: "dateEditor"
}
var dateEditor = function(cell, onRendered, success, cancel){
//cell - the cell component for the editable cell
//onRendered - function to call when the editor has been rendered
//success - function to call to pass the successfuly updated value to Tabulator
//cancel - function to call to abort the edit and return to a normal cell
//create and style input
var cellValue = moment(cell.getValue(), "DD/MM/YYYY").format("YYYY-MM-DD"),
input = document.createElement("input");
input.setAttribute("type", "date");
input.style.padding = "4px";
input.style.width = "100%";
input.style.boxSizing = "border-box";
input.value = cellValue;
onRendered(function(){
input.focus();
input.style.height = "100%";
});
function onChange(){
if(input.value != cellValue){
success(moment(input.value, "YYYY-MM-DD").format("DD/MM/YYYY"));
}else{
cancel();
}
}
//submit new value on blur or change
input.addEventListener("blur", onChange);
//submit new value on enter
input.addEventListener("keydown", function(e){
if(e.keyCode == 13){
onChange();
}
if(e.keyCode == 27){
cancel();
}
});
return input;
};
请告诉我如何在制表器代码中调用customEditor。根据文档,自定义编辑器是使用其变量或函数名直接分配的。不是字符串
columnMap =
{
align: "center", editor: dateEditor
}
你的代码顺序也不对。您无法分配尚不存在的内容。首先定义编辑器,然后分配给列映射,然后构造表。根据文档,自定义编辑器直接使用其变量或函数名分配。不是字符串
columnMap =
{
align: "center", editor: dateEditor
}
你的代码顺序也不对。您无法分配尚不存在的内容。首先定义编辑器,然后分配到列映射,然后构造表。它正在工作,非常感谢,我非常感谢你的帮助。它正在工作,非常感谢,我非常感谢你的帮助。