Skip to main content

Hello everyone,

 

I'm trying to get around the fact that you cannot set classes on table rows and colums.
|'ve fixed that using some custom javascript which is fired when the List method executes.

This works fine, however when I use a pager, the ajax panel refreshes and my javascript isn't called.

 

Does anyone of you know if there is some way to get a trigger when the View had loaded, paged or sorted?

 

Kind regards,

 

Serge

 

Any help would be appreciated, since I'm really stuck with this....

 

 

 


Hi all,

 

In case anyone is struggling with the same problem. I found an answer: Just put this in your custom javascript.

Snippet

(function(XHR) {
    "use strict";

    if (typeof(XHR.prototype.wasPatched) != "undefined"return;
    XHR.prototype.wasPatched = true;

    var open = XHR.prototype.open;
    var send = XHR.prototype.send;

    XHR.prototype.open = function(method, url, async, user, pass) {
        this._method = method;
        this._url = url;
        this._async = async;
        this._user = user;
        this._pass = pass;
        open.call(this, method, url, async, user, pass);
    };

    XHR.prototype.send = function(data) {

        var self = this;
        var oldOnReadyStateChange;
        var url = this._url;
        this._data = data;

        function onReadyStateChange() {
            if(self.readyState == 4 /* complete */) {
                /* This is where you can put code that you want to execute post-complete*/
                /* URL is kept in this._url */
                if (this._url.indexOf("Formatting.xslt") != -1) 
                {
                    // Because setTimeout is fired in another thread the main thread will be finished when this function is  called. So 1 ms is enough
                    setTimeout(function () { debugger; yourFunction(); }, 1);
                }
            }

            if(oldOnReadyStateChange) {
                oldOnReadyStateChange();
            }
        }

        /* Set xhr.noIntercept to true to disable the interceptor for a particular call */
        if(!this.noIntercept) {            
            if(this.addEventListener) {
                this.addEventListener("readystatechange", onReadyStateChange, false);
            } else {
                oldOnReadyStateChange = this.onreadystatechange; 
                this.onreadystatechange = onReadyStateChange;
            }
        }

        send.call(this, data);
    }
})(XMLHttpRequest);

Reply