简体   繁体   English

切换 model 时更新数据面板

[英]Update datapanel when the model is switched

I have an application linked with my autodesk account and I also have a panel dashboard that load the data from the current model, the issue is that this panel isnt update when I choose another model into the hub.我有一个与我的 Autodesk 帐户链接的应用程序,并且我还有一个面板仪表板,用于从当前 model 加载数据,问题是当我选择另一个 model 到集线器时,此面板没有更新。

Im trying to find the Autodesk.viewing.EVENT that can record this step but I couldnt.我试图找到可以记录此步骤的Autodesk.viewing.EVENT ,但我找不到。 All of them have been tryed and whitout success...他们都试过了,都没有成功……

Autodesk.Viewing.GEOMETRY_LOADED_EVENT , Autodesk.Viewing.GEOMETRY_LOADED_EVENT

Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT , Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT

Autodesk.Viewing.MODEL_ADDED_EVENT ... Autodesk.Viewing.MODEL_ADDED_EVENT ...

在此处输入图像描述在此处输入图像描述

I have got this working.我有这个工作。 Don't worry about events, it's working fine.不用担心事件,它工作正常。 Here are my changes and additions: PanelBarChart.js(same goes in piechart as well)这是我的更改和补充:PanelBarChart.js(饼图也是如此)

loadWithCustomProperty(property) {
    this.propertyToUse = property;
    this.chart.destroy();
    this.drawChart();
}

After creating list in dashboard.js, add the change event:在dashboard.js 中创建列表后,添加更改事件:

$('#'+_this._selectcontainer).change(function() {
        console.log($('#'+_this._selectcontainer+' option:selected').text())
        _this._panel.loadWithCustomProperty($('#'+_this._selectcontainer+' option:selected').text())            
    });   

Here _this._selectcontainer is UUID, because you're adding multiple chards, so id needs to be unique.这里 _this._selectcontainer 是 UUID,因为您要添加多个字符,所以 id 需要是唯一的。

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

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