繁体   English   中英

JS 甘特图未从数据库加载

[英]JS Gantt chart is not loading from database

我正在尝试使用 DHTMLX Gantt 创建一个简单的示例。 我已经设法让它工作,直到将数据存储在数据库中。 数据被存储,但我无法在打开页面时加载图表。 任何想法可能是什么问题? 我浏览了可用的文档,但找不到这种行为的根本原因。

这是 SQL 服务器在触发甘特图上的保存按钮后的样子:

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 

GanttLoader.js 这里Gantt 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");
}

索引.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");
    }
  }
}

在访问网页并加载图表时,我看到以下错误:

在此处输入图像描述

一直在关注他们的教程,无法弄清楚我错过了什么。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM