问题描述
我想更改面板的标题(使用dockingpanel创建)
我使用停靠面板'setTitle(...)'的方法。
发生以下错误
” DockingPanel.js:477未捕获的TypeError:无法读取未定义的属性'removeAttribute' 在MyPanel.o.setTitle(DockingPanel.js:477) “
如果您能告诉我如何更改停靠面板标题,我将不胜感激
解决方法
就像调用DockinPanel#setTitle
之前一样,它的晚餐构造函数被调用。请尝试在Autodesk.Viewing.UI.DockingPanel.call
或super()
// es5
var SimplePanel = function(parentContainer,id,title,content,x,y)
{
this.content = content;
Autodesk.Viewing.UI.DockingPanel.call(this,parentContainer,'');
// 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,y) {
super();
// Call setTitle here
}
}