我解决我的问题。添加自定义格式化程序:
var numEditor = function(cell, onRendered, success, cancel, editorParams){
var editor = document.createElement("input");
editor.setAttribute("type", "text");
var r = /^77[0-9]{9}$/
onRendered(function(){
editor.focus();
editor.style.css = "100%";
});
function successFunc(){
var n = editor.value.match(r);
if (n !== null) {
success(editor.value);
}
else {
cancel();
}
}
editor.addEventListener("change", successFunc);
editor.addEventListener("blur", successFunc);
return editor;
};
在制表符中:
{title:"", field:"msisdn", align:"center", editable:true, editor:numEditor},
玩得开心))
谢谢奥利,你的 Tabulator JS 着火了!