我正在尝试用DHTMLX甘特创建一个简单的例子。我已经设法让它工作,直到将数据存储在数据库中。数据会被存储,但我无法在打开页面时加载图表。有什么好主意吗?我已经看过了可用的文档,但是我找不到造成这种行为的根本原因。
触发甘特图上的Save按钮后,SQL Server是这样的:
5 New task 21.5.2021 0.00.00 1 0,0000 0 NULL 0
6 Joiuwqeowqe 21.5.2021 0.00.00 6 0,0000 0 NULL 0
7 New task 21.5.2021 0.00.00 4 0,0000 0 NULL 0
8 New task 21.5.2021 0.00.00 1 0,0000 0 NULL 0
9 New task 21.5.2021 0.00.00 1 0,0000 0 NULL 0
10 New task 21.5.2021 0.00.00 1 0,0000 0 NULL 0
NULL NULL NULL NULL NULL NULL NULL NULL 这里加载了甘特js的GanttLoader.js:
import 'https://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.js';
// ../gantt-master/codebase/dhtmlxgantt.js
// https://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.js
export function InitDHTML() {
// specifying the date format
gantt.config.date_format = "%Y-%m-%d %H:%i";
// initializing gantt
gantt.init("gantt_here");
// initiating data loading
gantt.load("/api/data");
// initializing dataProcessor
var dp = new gantt.dataProcessor("/api/");
// and attaching it to gantt
dp.init(gantt);
// setting the REST mode for dataProcessor
dp.setTransactionMode("REST");
}Index.razor:
@page "/gantt"
<h3>Gantt</h3>
<div id="gantt_here" style="width: 100%; height: 100vh;"></div>
@inject IJSRuntime JS
@code{
private IJSObjectReference importedDHTML;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// import the script from the file
importedDHTML = await JS.InvokeAsync<IJSObjectReference>(
"import", "./GanttLoader.js");
// Initialize dhtmlxgantt
await importedDHTML.InvokeAsync<IJSObjectReference>(
"InitDHTML");
}
}
}在浏览网页和加载图表时,我看到以下错误:

一直在学习他们的教程,不知道我错过了什么。
发布于 2021-05-26 14:47:18
https://stackoverflow.com/questions/67683227
复制相似问题