Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Updating content in content area via DOJO

Vote:
 

How to refresh items in content area on mouse click?

I have a scenario where I change the content area items on server side and when the editor click on the CA (ie. editor want to D&D items) I need to refresh the CA content tree.

Did someone tried something similar?

#205179
Edited, Jul 01, 2019 15:43
Vote:
 

Hi Praful, 

Thank you on your quick response. I already readed that article ( and any other that I could find regarding this) and I use it for a start point.

I track what events are triggered on mouse click on CA or CA item and write this JS file :

define([
    "dojo",
    "dojo/_base/array",
    "dojo/_base/lang",
    "dojo/_base/declare",
    "dojo/topic",

    "dijit",

    "epi/_Module",
    
    "epi-cms/contentediting/editors/ContentAreaEditor"
    ],
    function (
        dojo,
        array,
        lang,
        declare,
        topic,

        dijit,

        _Module,
        
        _contentAreaEditor
    ) {
        return declare([_Module, _contentAreaEditor],
        {
            initialize: function() {
                this.inherited(arguments);

                topic.subscribe("focusNode", lang.hitch(this, "_onFocus"));
                topic.subscribe("widgetBlur", lang.hitch(this, "_onBlur"));
            },

            _onFocus: function (data) {
                console.log("onFocus: ", data);
                var item = dijit.byId(data.id);
                console.log("f-dijit: ", item);
            },

            _onBlur: function (data) {
                console.log("onBlur: ", data);
                console.log("b-dijit: ", dijit.byId(data.id));
            }
        });
    }
);

And I stack here. I can't izolate the clicked widget and than to call a web api method or something.

#205184
Edited, Jul 01, 2019 16:57
Vote:
 

Hi,

I think the solution: Refresh on click is not good for UX. Otherwise we can use a kind of SignalR and publish/subscribe event from server and refresh content area data or could be better we will push new notification like: "[PropertyName]'s value was changed, click [here] to refresh". (This behaviour like notfication when we have more than one editor is working on the same page.)

// Ha Bui

#205281
Jul 04, 2019 5:36
Vote:
 

Hi Ha Bui, 

Thank you on your response and time. I am rethinking the whole situation and looking into other options.

#205308
Jul 04, 2019 16:44
* 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.