Import from mendix - Pluggable web widget

2
Hi, I am trying to create a pluggable web widget. In this widget, I need to load some data and want to check on the ValueStatus of the object. Therefore, I want to import to ValueStatus in my widget by using import { ValueStatus } from "mendix"; Unfortunately, this import result in the following error: factoryThrew Error: factoryThrew Without the import, the widget is working fine. I also ‘checked the widgets’ using Studio Pro, but it says that all widgets are build correctly. Why does this import not work? Or is there any other place where I should include the import?  
asked
2 answers
0

Did you example code come from somewhere or did you write it? I’m not sure there’s a “ValueStatus” module available anywhere. What I did find was the type ValueStatus referenced inside of a DynamicValue type, which is how attributes are exposed in a pluggable widget.

So I think you’re trying to access or set the value of an attribute. The how-to guide here shows you how to use a string attribute in a pluggable widget.

I hope that helps!

 

answered
0

Hi Kevin,

 

For me this import works. I am importing some more things from the “mendix’ React library:

import {ObjectItem,ListValue, ListActionValue, ListAttributeValue,ValueStatus} from "mendix";

And specifically using ValueStatus here:

        if (!datasource || datasource.status !== ValueStatus.Available || !datasource.items) {
            return null;
        }

To check whether a datasource returns objects. It does work for me, the widget runs smoothly.. I am using mendix 8.15.2.

answered