Expression returns loading for Pluggable Widget

0
Hey there, I’ve built a pluggable widget that pulls from the database and has the ability to constrain what values can be returned. Currently, I’m simply trying to compare an entity’s integer attribute with a helper entity’s integer attribute: The idea is that this pulls all “Hotels” from the database with a rating that matches our search rating. However, no Hotels are ever returned with that constraint, or any variation of it for that matter. I have a separate dataview retrieving the Hotels with a matching rating via the Microflow “getstuff” just to see what should be appearing and can confirm that the Microflow retrieval works as expected. Do Pluggable widget expressions simply not have the ability to compare with the attributes of non-currentObject attributes? It appears that the Current Object is never loading for the expression. Any attempt to run a comparison on the Current Object in the expression causes the result status to be stuck on ‘loading’ with a value of undefined. I have tried simply doing if ($currentObject != empty) return true else false and the expression returns as “loading”. What’s interesting is that I have even put it in a loop to continue running the expression until it gets past “loading”, but that never happens. What’s even more interesting is that I have an old version of this widget that has a working expression, but the expression and the way I’m handling it are the same for the old and new versions. What could be causing Mendix to get stuck on loading the Current Object of the expression for the pluggable widget? This is how I’m calling the expression from the widget’s side: let attributesToAdd = []; if (this.props.constraint) { // If the dev set a constraint (The expression) for (let object of this.props.myDatasource.items) { let constraintResult = this.props.constraint.get(object); console.log(constraintResult); if (constraintResult.value) { // If this item passes our constraint attributesToAdd.push(object); } } } Is there anyone out there who knows what’s going on?
asked
1 answers
1

As it would turn out, this was not due to the expression or the code handling the expression.

It was due to a <systemProperty key=”Label”/> that I had added to the XML file. This allows a developer to add a label to the widget, just like with Mendix input widgets.

Strangely enough, this was preventing the CurrentObject from being passed to the expression (or maybe it was entirely breaking the expression. Regardless, it stops working when the label is added). Somehow, the label must be changing the context of the widget or something. I have reported this bug to Mendix.

So simple, yet it took me like 2 months worth of weekends to find that. Lol.

answered