setValue is not updating values on server

0
Question: I'm developing a pluggable widget and need assistance with updating an attribute's value. When I call `setValue` to update the value, no request is sent to the server. I've confirmed that the attribute is editable and available at the time of modification. I'm passing a plain string as the new value. Context: The attribute is editable. The attribute is available at the time of modification. I'm passing a plain string as the new value. Error/Issue: No request is sent to the server after calling `setValue` to update the attribute's value. I've inspected the requests but didn't see any outgoing traffic.  
asked
1 answers
1

Hi Yongyan Chen,

 

Nice work developing a pluggable widget!

When you call the setValue method on a MendixObject, it's updated value is stored in the browser's state. If you press Ctrl-Alt-G while having the Console open in your browser, it gives a dump of the state, and it should also contain your updated MendixObject.

If you want to persist it to the database, you can commit the object by calling the commit() function, this will trigger network activity:

mx.data.commit({
    mxobj: obj,
    callback: function() {
        console.log("Object committed");
    },
    error: function(e) {
        console.error("Could not commit object:", e);
    }
});

If you just want to use the changed object in a microflow, that's also possible, then just pass it along as parameter.

Good luck!

Kind regards,

Johan Flikweert

 

answered