Commit e2617b49 authored by Nigel McNie's avatar Nigel McNie
Browse files

Handle the case when there is no pagination related DOM stuff available - as...

Handle the case when there is no pagination related DOM stuff available - as happens when there are no results.
parent c12f5849
......@@ -193,18 +193,26 @@ if (ul) {
}
sendjsonrequest(p.jsonScript, queryData, 'GET', function(data) {
getFirstElementByTagAndClassName('tbody', null, p.datatable).innerHTML = data['data']['tablerows'];
var tbody = getFirstElementByTagAndClassName('tbody', null, p.datatable);
if (tbody) {
tbody.innerHTML = data['data']['tablerows'];
}
// Update the pagination
var tmp = DIV();
tmp.innerHTML = data['data']['pagination'];
swapDOM(p.id, tmp.firstChild);
if ($(p.id)) {
var tmp = DIV();
tmp.innerHTML = data['data']['pagination'];
swapDOM(p.id, tmp.firstChild);
// Run the pagination js to make it live
eval(data['data']['pagination_js']);
// Run the pagination js to make it live
eval(data['data']['pagination_js']);
}
// Update the result count
getFirstElementByTagAndClassName('div', 'results', p.id).innerHTML = data['data']['count'] + ' results'; // TODO i18n and pluralisation
var results = getFirstElementByTagAndClassName('div', 'results', p.id);
if (results) {
results.innerHTML = data['data']['count'] + ' results'; // TODO i18n and pluralisation
}
});
});
}
......
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