gojs动态刷新流程图及模板方法

本文介绍了一种解决在动态构建div内容时出现的'div已有关联图表'错误的方法。通过将图表与div的关联设为null,可以有效避免重复加载导致的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题:

I am dynamically building the content of a div using a function . First time it is loading ok but second time it is giving the common error

'div already has a diagram associated with it' . I have tried the solution by setting the div id to null . But it is giving error div is not a function. My code is like this. How to resolve this issue.

this.addSearchPaletteDatas = function (datas) {

    this.diagram.div('myPaletteSearch') = null;
    this.SearchPalette =
this.diagram(go.Palette, "myPaletteSearch",  // must name or refer to the DIV HTML element
  {

      "animationManager.duration": 800 // slightly longer than default (600ms) animation
  });
    this.SearchPalette.layout.sorting = go.GridLayout.Forward;
    this.SearchPalette.nodeTemplateMap.add("Default", templateDiagram);
    this.SearchPalette.nodeTemplateMap.add("Start", templateDiagram);
    this.SearchPalette.nodeTemplateMap.add("End", templateDiagram);

    for (var i = 0; i < datas.length; i++) {
        this.SearchPalette.model.addNodeData(datas[i]);
    }

};

解决方法:

You need to set Diagram.divhttp://gojs.net/latest/api/symbols/Diagram.html#div5, to null. In this case I think:

    this.SearchPalette.div = null;

 官方答案:

161324_j40O_2391658.png

更多属性设置及说明:http://gojs.net/latest/api/symbols/Diagram.html

转载于:https://my.oschina.net/u/2391658/blog/856390

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值