Search code examples
javascripteventsautodesk-forgedashboardviewer

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.

Im trying to find the Autodesk.viewing.EVENT that can record this step but I couldnt. All of them have been tryed and whitout success...

Autodesk.Viewing.GEOMETRY_LOADED_EVENT,

Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT,

Autodesk.Viewing.MODEL_ADDED_EVENT...

enter image description here enter image description here


Solution

  • 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)

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

    After creating list in dashboard.js, add the change event:

    $('#'+_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.