November Happy Hour will be moved to Thursday December 5th.

Extending all properties view and updating contentdata on change with dojo

Vote:
 

I've been following along this tutorial: https://gregwiechec.com/2015/05/extending-all-properties-view/ ... however there is a bit of a gap I need some help with.

Firstly, one piece not shown in that tutorial is the actual view code that outputs the red message:

@if(Model.CurrentPage.ShowMaintenanceMessage){
<div class="alert alert-danger">
    <p>@Model.CurrentPage.MaintenanceMessage</p>
</div>
}

Ok so after implementing the code in the tutorial, let's say you toggle the checkbox on or off in "All Properties" view and then click back to "On-Page Edit" view, then whether or not the message should be displayed will not be updated immediately. It seems like it might work the first time, but if you turn it on, switch over, turn it off, switch over, etc, it will not update. Why does this not immediately update the edit view?

In other words, the following code does not prompt CMS to do any kind of update that would impact "On-Page Edit":

this.own(checkboxWidget.on("change", lang.hitch(this, function(value) {
    if (checkboxWidget.checkbox.get("readOnly")) {
        return;
    }
    textWidget.set("readOnly", !value);
})));

if (checkboxWidget.checkbox.get("value") == false) {
    textWidget.set("readOnly", true);
}

It seems like I have to hit "Publish" for the effect to take place.

I did a bit of searching to come across a number of posts from many years ago that dealt with people trying to save values in Dojo and the server not being updated immediately. I think we have the same problem here, but the examples I found (for example) had to do with a custom editor for a single property, not anything at this higher FormEditing level (custom ViewConfiguration).

I suspect that I might have to trigger some kind of AJAX call (pub/sub) to the system to get it to update, but the one post I found had a "half-explained" final answer and referenced a source of information that is basically greek.

Can anyone advise how to update code like this to trigger the "On-Page Editing" experience to update automatically every time?

Thanks!

#261088
Aug 24, 2021 23:42
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.