mendix / EnumSlider

A slider based on your enumeration values
Apache License 2.0
0 stars 1 forks source link

mx.ui.destroyContext(); #4

Closed stephanbruijnis closed 8 years ago

stephanbruijnis commented 8 years ago

Hi,

I'm upgrading a Mendix project from 5.8.1. to 5.16.1, I've also updated the widgets to newer version. However one widget (EnumSlider) still causes some errors in the browser console.

mx.ui.destroyContext(); is not a function.

I can't find any Mendix documentation on depreciation or alternatives of this function.

Is mx.ui.destroyContext(); deprecated and is the destroy context handled by the runtime or should I use another function?

I've asked this question in the Mendix support portal, but they referred me to github.

With kind regards, Stephan

dson commented 8 years ago

mx.ui.destroyContext was to be used iff the context was created using mx.ui.newContext. Both API's were deprecated and scheduled to be removed in Mendix 6. However, it appears that destroyContext was already removed in 5.10.0, probably by accident.

To fix the issue calls to mx.ui.newContext should be replaced by a call to its constructor:

require(["mendix/lib/MxContext"], function(MxContext) {
    var context = new MxContext();
}

The call to destroyContext can then safely be removed.

stephanbruijnis commented 8 years ago

Thanks, for the explanation!