项目管理软件dhtmlxGantt配置教程(九):输入值验证方法

这篇文章给大家带来dhtmlxGantt的输入值验证。

  • 通过inlineEditors 对象的onBeforeSave事件
function editAnotherCell(inlineEditors){  var value = inlineEditors.getValue();  if(confirm(`does '${value}' look ok to you)){    inlineEditors.save();  }}var mapping = {  init: function(inlineEditors){    gantt.attachEvent("onTaskClick", function (id, e) {      var cell = inlineEditors.locateCell(e.target);      if (cell && inlineEditors.getEditorConfig(cell.columnName)) {        if (inlineEditors.isVisible()) edit_another_cell(inlineEditors)        else inlineEditors.startEdit(cell.id, cell.columnName);        return false;      }      return true;    });    gantt.attachEvent("onEmptyClick", function () {      inlineEditors.hide();      return true;    });  },  onShow: function(inlineEditors, node){    node.onkeydown = function (e) {      e = e || window.event;      if(e.defaultPrevented){        return;      }      var keyboard = gantt.constants.KEY_CODES;      var shouldPrevent = true;      switch (e.keyCode) {        case gantt.keys.edit_save:          var value = inlineEditors.getValue();          if(confirm(`does '${value}' look ok to you)){            inlineEditors.save();          }          break;        case gantt.keys.edit_cancel:          inlineEditors.hide();          break;        case keyboard.TAB:          if(e.shiftKey){            if (inlineEditors.isVisible()) editAnotherCell(inlineEditors)            else inlineEditors.editPrevCell(true);          }else{            if (inlineEditors.isVisible()) editAnotherCell(inlineEditors)            else inlineEditors.editNextCell(true);          }          break;        default:          shouldPrevent = false;          break;      }      if(shouldPrevent){        e.preventDefault();      }    };  },  onHide: function(inlineEditors, node){}};gantt.ext.inlineEditors.setMapping(mapping);gantt.init("gantt_here");

dhtmlxGantt是用于跨浏览器和跨平台应用程序的功能齐全的Gantt图表,可满足项目管理控件的所有需求,是最完善的甘特图图表库。了解更多DhtmlxGantt相关内容和资讯,欢迎访问 进行咨询或者私信我获取正版试用版及 价。


甘特图控件交流群:764148812    欢迎进群交流讨论

更多正版甘特图软件下载、购买、授权咨询,请点这里!

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2022年9月15日
下一篇 2022年9月15日

相关推荐

发表回复

登录后才能评论