Giter Site home page Giter Site logo

Comments (3)

jeremyjone avatar jeremyjone commented on May 14, 2024

@dazhaocode 数据还未请求回来的时候,为什么会用到这里?这里只有数据更新时才会调用。可否给一个用例?

from gantt.

dazhaozhao avatar dazhaozhao commented on May 14, 2024

@jeremyjone
sure! open this url :https://codesandbox.io/s/serene-poitras-3r8w8h
image
code is here: https://github.com/dazhaocode/jzgantt-case.git

from gantt.

jeremyjone avatar jeremyjone commented on May 14, 2024

@dazhaocode 我看到了。

原因:您的数据中没有 children 键名。

解决方案:请确保数据中 childrenindexstartDate 以及 endDate 四个属性的存在(其中后三项可以通过传值修改键名)。为了确保所有数据的统一,在定义数据类型的同时,您就应该定义它:

interface IData {
  id: number;
  name: string;
  startDate: string;
  endDate: string;
  children: Array<IData>;
}

当数据类型正确的时候,所有数据都会正确显示。

===

简要说明:为了保证数据的统一,以及每一层数据的准确性,我们需要确保数据中至少4个属性的存在:

  • index 确保数据的唯一性,它应对于所有数据全局唯一的。通过 data-index 替换
  • children 可以使数据层级嵌套,如果没有子集,只需要置空即可
  • startDate 可以在甘特图中正确渲染数据的起始日期。通过 start-key 替换
  • endDate 可以在甘特图中正确渲染数据的截止日期。通过 end-key 替换

详细内容,请见 文档 - data

from gantt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.