On-Page Edit Mode: run javascript (like uniform.js) without full page reload



We use uniform.js to style our controls. But when editor changes a property (from on page edit mode) the property (actually it's a block) automatically updated using dojo ajax, and editor sees plain html controls (see screenshot below). 

What is the easiest way to run something like $updatedBlock.find(".js-plugin").uniform() on each html container updated by AJAX ?

Oct 09, 2014 16:56

Missed screenshot (http://dl.dropbox.com/u/71573976//screenshots/2014-10-09_17h50_59.png): 

(P.S. Not sure why, but I'm unable to add image, so placing a link to it)

Edited, Oct 09, 2014 16:57

Have you found a solution to this?

Oct 16, 2014 13:26

Hi, Sara.

As a workaround I use @Html.FullRefreshPropertiesMetaData(...) to refresh the whole page.

I tried to hack it using dojo/request/notify (I'm not good in dojo, so probably there is a better way to do the same) and trying to run plugins code some time after ajax response received from server: 

    "dojo/dom", "dojo/dom-construct",
    "dojo/json", "dojo/domReady!"],
function (xhr, notify, on, dom, domConst, JSON) {
    console.log("TEST AJAX");
    notify("done", function (response) {

        if (response.text && response.url.indexOf("PropertyRender/Render") > -1) {
            var serverResponse = JSON.parse(response.text);

            if (serverResponse && serverResponse.innerHtml) {
                var $html = $(serverResponse.innerHtml);
                console.log("PLUGIN DETECTED");


                var targetWindow = $("iframe")[0].contentWindow;
                var App = targetWindow.App;

                setTimeout(function() {
                    var $container = targetWindow.$(".js-plugin");
                }, 200);


and it usually works, but  not always

Oct 16, 2014 14:09
* 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.