Trinidad + jQuery

After a Trinidad Ajax call (PPR), DOM will change and jQuery non "bind" again on html controls. I use this script to fix this issue.



jQuery(document).ready(function () {

var requestQueue = TrPage.getInstance().getRequestQueue();
requestQueue.addStateChangeListener(myCallbackEnd);

addWidget();
});

function addWidget() {
// ADD HERE YOUR jQuery CODE (plugin and other)
}

function myCallbackEnd(state)
{
var busy = state == TrRequestQueue.STATE_BUSY;
// var div = document.getElementById("load");
// div.style.display = busy ? "inline" : "none";

if (!busy) {
// alert("changesToDom=" + changesToDom);
addWidget();
}
}

Commenti

Anonimo ha detto…
Hi friend--
I just came across this post, when trying to integrate jQuery and Trinidad and encountering the same problem. It appears as if you didn't post the script in question. I know this post is quite old, but do you have the script available? I am struggling! Thank you in advance.
Mirco Attocchi ha detto…
Hi friend, I've updated my Post with code, I'm sorry it was hidden because inside a script tag.

Post popolari in questo blog

Dirette video su Youtube con Raspberry PI

Eclipse underscore not visible

Batch Convert CSV to XLSX with LibreOffice (OpenOffice)