Error while using gauge chart in mendix

0
AssetManager.Home.templateGrid1: Error while applying context Error: AssetManager.Home.gaugeChart1: Error while applying context Error: AssetManager.Home.gaugeChart1: Error while applying context TypeError: Cannot use 'in' operator to search for 'unsubscribe' in undefined Error: AssetManager.Home.templateGrid1: Error while applying context Error: AssetManager.Home.gaugeChart1: Error while applying context Error: AssetManager.Home.gaugeChart1: Error while applying context TypeError: Cannot use 'in' operator to search for 'unsubscribe' in undefined     at http://localhost:8082/mxclientsystem/mxui/mxui.js?637140908241374475:40:19908     at Object.t.collect (http://localhost:8082/mxclientsystem/mxui/mxui.js?637140908241374475:35:66807)     at Object.e.exports.applyContext (http://localhost:8082/mxclientsystem/mxui/mxui.js?637140908241374475:40:19806)     at E.(anonymous function).C.passContext (http://localhost:8082/mxclientsystem/mxui/mxui.js?637140908241374475:35:94781)     at E.(anonymous function).C.applyContext (http://localhost:8082/mxclientsystem/mxui/mxui.js?637140908241374475:35:94666)     at E.(anonymous function).C.<anonymous> (http://localhost:8082/mxclientsystem/mxui/mxui.js?637140908241374475:5:26974)     at Object.t.collect (http://localhost:8082/mxclientsystem/mxui/mxui.js?637140908241374475:35:66807)
asked
1 answers
0

I think this is related to Sam Loeys problem which he added as a review on the widget in the AppStore. Since he had the same error I assume it is the same issue, so see my answer below. Also, on Github you can download version 1.4.x I just created for usage of the D3GaugeChart with the MicroflowTImer widget.

Answer on Sam Loeys review:

 

I inspected the error and it originates from the microflow timer widget, not from the Gauge chart widget... If you open the error appearing in your browser you can see the error originates from line 212 of the MicroflowTimer.js file: mx.data.action(mfObject, this); I would suggest to get rid of the Microflow Timer widget as it is in principle not really good practice to use this...

 

As an intermediate step, can't you just update the RestResponse objects with values instead of continuously creating new ones? The problem you are seeing is that both widgets on your page are creating subscriptions to the RestResponse objects, but your MicroflowTimer object destroys those asynchronuouusly, hence giving unpredictable behavior. For this Microflow Timer usage scenario I could strip the subscriptions my widget is creating, which the Microflow Timer widget breaks, but then it wouldn't work well with attribute updates anymore...

So, if you really need a version that would work for your scenario, I could create a separate version without this ‘_resetSubscription’ function. I just created it and tested this. I added this new version 1.4.x to GitHub for you. Be aware; updating from AppStore will break it again. Please check and let me know if it solves your problem!

 

 

answered