assert
Description
如果指定的表达式为假,则在屏幕右上角的红色弹出框中显示 errorMessage
assert: (expression: any, errorMessage: string) => void
Parameters
expression- (required) any - 用于断言表达式的 truthy 值,若为 falsy 值则断言失败errorMessage- (required) string - 将在红色弹出框中显示的错误信息
Example
gantt.attachEvent("onLoadEnd", function(){
gantt.assert(gantt.getTaskCount(), "no data loaded");
});
Details
dhtmlxGantt 代码库使用 gantt.assert 来检测组件的无效状态
错误显示方式可以通过 show_errors 配置进行调整。
错误也可以通过 onError 事件以编程方式进行处理。
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.