Commit 61152d19 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Table renderer can display special content if table is empty

parent 89debc93
......@@ -5,6 +5,7 @@ function TableRenderer(target, source, columns, options) {
this.columns = columns;
this.paginate = true;
this.statevars = ['offset','limit'];
this.emptycontent = false; // Something to display when no results are found
addLoadEvent(function() {
self.table = target;
......@@ -36,6 +37,10 @@ function TableRenderer(target, source, columns, options) {
appendChildNodes(ref, tr);
});
}
if (self.emptycontent) {
$(self.table).parentNode.insertBefore(DIV(null,self.emptycontent),$(self.table));
}
});
this.renderdata = function(data) {
......@@ -89,6 +94,16 @@ function TableRenderer(target, source, columns, options) {
self.offset = data.offset;
self.count = data.count;
if (self.emptycontent) {
if (self.count > 0) {
hideElement($(self.table).previousSibling)
showElement(self.table);
}
else {
hideElement(self.table);
showElement($(self.table).previousSibling);
}
}
self.renderdata(data);
},
function (error) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment