Commit 36e94485 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix tablerenderer pagination for user search table

parent 4a2c3305
......@@ -177,6 +177,7 @@ function TableRenderer(target, source, columns, options) {
self.offset = data.offset;
self.count = data.count;
self.updatecallback(data);
if (self.paginate) {
if (typeof(self.assertPager) == 'function') {
self.assertPager(self.offset, self.limit, self.count);
......@@ -193,7 +194,6 @@ function TableRenderer(target, source, columns, options) {
showElement(self.table.previousSibling);
}
}
self.updatecallback(data);
self.renderdata(data);
},
function (error) {
......
......@@ -42,6 +42,7 @@ foreach ($userfields as $k => $v) {
$userfieldstrings[] = get_string($k, 'artefact.internal');
}
$userfields = json_encode(array_keys($userfields));
$ncols = count($userfieldstrings);
$userfieldstrings = json_encode($userfieldstrings);
$javascript = <<<EOF
......@@ -58,12 +59,14 @@ results.statevars.push('type');
results.emptycontent = '{$noresults}';
results.updatecallback = function (d) {
if (d.type == 'user') {
results.linkspan = {$ncols};
if (!$('userfields')) {
appendChildNodes(results.thead, TR({'id':'userfields'},
map(partial(TD, null), userfieldstrings)));
}
}
else {
results.linkspan = 1;
removeElement('userfields');
}
}
......
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