1

I have a dijit.Tree which works fine. Users can add, delete and rename nodes on this tree (jsfiddle) if they have special authorization on it.

The next step is to post this changes back to the server, which works perfect, using dojo.xhrPost in conjunction with an XAgent (instead of an XAgent this functionality could be achieved using extension library control for REST-Services of type customRestService. However, this is not available until domino version 9...)

Source code:

<xp:button value="Submit tree updates back to server " id="btnSubmit">
    <xp:this.onclick><![CDATA[dojo.xhrPost({
url: "folderService.xsp", // XAgent
handleAs: "json",
timeout: 1000,
postData: treeStore._getNewFileContentString(), // treeStore
headers: { "Content-Type": "application/json", "Accept": "application/json" },
load: function(data) {
    if (data.success) {
        console.log("all folders saved " + data.success);
        dojo.byId("#{id:txtMessage}").innerHTML = data.message; ???
        dojo.removeClass("#{id:txtMessage}", "lotusHidden"); ???
        XSP.partialRefreshGet("#{id:wrapper}", {}); ???
    }
},
error: function() {
    dojo.byId("#{id:txtMessage}").innerHTML = 'Oops something goes wrong. The update on the folders weren\'t saved.'; ???
    dojo.removeClass("#{id:txtMessage}", "lotusHidden"); ???
    XSP.partialRefreshGet("#{id:wrapper}", {}); ???
} 
});]]></xp:this.onclick>
</xp:button>

Now the question:

I have the requirement to show some information to the user which comes back from the server (load : function(data) {...}).

Possible solutions:

  1. Do it only on client side (e.g. dojo.byId("#{id:txtMessage}").innerHTML = data.message;)?

Pros: No partial refresh needed

Cons: I can't work with already implemented custom controls (e.g. computed rendered property)

  1. Do some partial refresh after a successfull xhrPost? If this is the right choice, how and were I should implement a partial refresh after a successfull xhrPost?

My feeling says no, because why I should do a partial refresh only for the making information visible (e.g. rendered property...).

  1. Do something else?

I am not sure which is the best approach to handle my requirements?

Hint: I am working on a Domino Sever 8.5.3 FP6

Thanks in advance for any answer.

Eric McCormick
  • 2,716
  • 2
  • 19
  • 37
Georg Kastenhofer
  • 1,387
  • 12
  • 32

0 Answers0