I've been following the instructions in
http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable to modify the contents of a
livetable, with the following jQuery:
require(['jquery', 'xwiki-events-bridge'], function($) {
document.observe("xwiki:livetable:newrow", function(ev) {
$('.working').each(function () {
var txt = $(this).text();
if (txt== "true") {
$(this).append($("<span>", {
class: "glyphicon glyphicon-ok"
}))
} else if (txt == "false") {
$(this).append($("<span>", {
class: "glyphicon glyphicon-remove"
}))
}
});
document.fire("xwiki:livetable:ready", {});
});
});
However, this only appears to work once I cause the livetable to update after it has
loaded the first time (e.g. by sorting a column). How do I get it to run the first time?
Also, what is the purpose of the last line?:
document.fire("xwiki:livetable:ready", {});
This appears in the example code "Display ratings in the Livetable on row
event", but doesn't obviously affect anything if I remove it.