Help with widgets: Refresh a form

4
Continuining on my previous topic about help with widgets. I'm trying to refresh a datagrid and a reference set selector after i added new objects to them. How can i refresh these widgets or the current form? What i would like to do is to refresh the set selector on the click of a button. I tried searching for any direct refresh functions but could not find them. Thus my guess would be that i would need to retrieve the form on which the button is located and refresh that form or its components separately. So far i did call on the MxObject.save() function as was suggested but this did not refresh datagrid as i hoped it would. However, if i refresh the complete page and open the dataview containing my widget it has updated the reference set selector. Update 1 This is my code to call the microflow, which is executed just fine, however when running my microflow it tells me that my input variable is empty while the guid i commit is not empty. callMicroflow : function(){ alert("Dit is het this guid van het dataobject " + this.dataObject.getGUID()); mx.xas.action({ error : function() { logger.error(this.id + "error: XAS error executing microflow"); }, guids : [this.dataObject.getGUID()], actionname : this.executeMicroflow, callback : function(){} }); }, Update 2 i changed my code a little and after some some testing i uncovered that with a different call it does work. While this works, it does give me an javascript error on the object.save call, stating _2a1 is undefined. /* Set the relation of the entity to the entity that is clicked uppon */ setResult : function(objArray) { if(objArray.length>0){ var path = this.searchEntity.split("/"); var objt = objArray[0]; //add the reference to the context object this.dataObject.addReference(path[0], objt); this.dataObject.save(this.callMicroflow(this.dataObject.getGUID())); } }, callMicroflow : function(guid){ alert("Dit is het this guid van het dataobject " + guid); mx.processor.xasAction({ error : function() { logger.error(this.id + "error: XAS error executing microflow"); }, actionname : this.executeMicroflow, applyto : 'selection', guids : [guid] }); }, Update 3: Okey i got it working now without an error, instead of using the callback i simply created an empty function and called the microflow separately. setResult : function(objArray) { if(objArray.length>0){ var path = this.searchEntity.split("/"); var objt = objArray[0]; //add the reference to the context object this.dataObject.addReference(path[0], objt); this.dataObject.save(function(){}); this.callMicroflow(this.dataObject.getGUID()); } }, Thanks for all the help!
asked
2 answers
3

Ok, i found a solution for your problem which avoids the needs of calling a microflow; the refresh action of a microflow is similar to directly calling in the client:

mx.processor.refreshCache(obj.getGUID()); mx.processor.objectUpdateNotification(obj);

answered
2

An option could be to call a microflow containing a change activity with refresh checked. You can also call the refresh functions from a Java activity:

  • addRefreshObjectFeedback(IMendixIdentifier id)
  • addRefreshObjectListFeedback(List<IMendixIdentifier> ids)
  • addRefreshClass(String objectClass)
answered