【问题标题】:How to chage dockingpanel's title如何更改停靠面板标题
【发布时间】:2020-09-14 17:52:41
【问题描述】:

我想更改面板的标题(使用停靠面板创建)

我使用方法 dockingpanel 'setTitle(...)' 。

出现以下错误

" DockingPanel.js:477 未捕获类型错误:无法读取未定义的属性“removeAttribute” 在 MyPanel.o.setTitle (DockingPanel.js:477) "

如果您能告诉我如何更改停靠面板标题,我将不胜感激

【问题讨论】:

    标签: autodesk-forge


    【解决方案1】:

    这几乎就像你在调用它的晚餐构造函数之前调用了DockinPanel#setTitle。请尝试在Autodesk.Viewing.UI.DockingPanel.callsuper() 之后调用该函数

      // es5
      var SimplePanel = function(parentContainer, id, title, content, x, y)
      {
          this.content = content;
          Autodesk.Viewing.UI.DockingPanel.call(this, parentContainer, id, '');
          // Auto-fit to the content and don't allow resize.  Position at the coordinates given.
          //
          this.container.style.height = "auto";
          this.container.style.width = "auto";
          this.container.style.resize = "none";
          this.container.style.left = x + "px";
          this.container.style.top = y + "px";
        
    
          // Call setTitle here
      };
    
      SimplePanel.prototype = Object.create(Autodesk.Viewing.UI.DockingPanel.prototype);
      SimplePanel.prototype.constructor = SimplePanel;
    
      // es6
      class SimplePanel extends Autodesk.Viewing.UI.DockingPanel {
         constructor(parentContainer, id, title, content, x, y) {
           super();
    
           // Call setTitle here
         }
    
      }
    

    【讨论】:

      猜你喜欢
      • 2011-12-01
      • 1970-01-01
      • 2017-05-23
      • 2013-11-24
      • 1970-01-01
      • 2011-05-30
      • 1970-01-01
      • 2013-10-15
      • 1970-01-01
      相关资源
      最近更新 更多