Commit 50cde32d authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files
parents 975e2628 e68f754f
......@@ -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) {
......
......@@ -27,11 +27,13 @@
defined('INTERNAL') || die();
// General form strings
$string['cancel'] = 'Cancel';
$string['submit'] = 'Submit';
$string['add'] = 'Add';
$string['cancel'] = 'Cancel';
$string['delete'] = 'Delete';
$string['edit'] = 'Edit';
$string['save'] = 'Save';
$string['submit'] = 'Submit';
$string['update'] = 'Update';
$string['no'] = 'no';
$string['yes'] = 'yes';
......@@ -190,8 +192,6 @@ $string['changepassword'] = 'Change password';
$string['activity'] = 'Recent activity';
$string['emailname'] = 'Mahara System'; // robot!
$string['save'] = 'Save';
$string['update'] = 'Update';
$string['config'] = 'Config';
......@@ -211,7 +211,9 @@ $string['heightshort'] = 'h';
// Search
$string['search'] = 'Search';
$string['query'] = 'Query';
$string['querydescription'] = 'The words to be searched for';
$string['results'] = 'Results';
$string['noresultsfound'] = 'No results found';
$string['resultsfor'] = 'Results matching "%s"';
?>
......@@ -59,6 +59,7 @@ function search_submit($values) {
}
//@todo: Show 'no results found' for an empty query.
$noresults = get_string('noresultsfound');
$javascript = <<<JAVASCRIPT
var results = new TableRenderer(
......@@ -78,6 +79,7 @@ function newsearch() {
}
results.statevars.push('query');
results.emptycontent = '{$noresults}';
JAVASCRIPT;
......
Markdown is supported
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