Skip to content

Commit

Permalink
Fix #1221: Hide row filter dropdown when the search is one page long. (
Browse files Browse the repository at this point in the history
…#1265)

* Hide row filter dropdown when the search results < 10.
* Hide page length dropdown with <10 search results
  • Loading branch information
niharika1995 authored and oliverroick committed Mar 16, 2017
1 parent 849cafa commit e5b02b2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cadasta/core/static/js/dataTables.conditionalPaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
speed = 'slow',
conditionalPaging = function(e) {
var $paging = $(api.table().container()).find('div.dataTables_paginate'),
$dropdown = $(api.table().container()).find('div.dataTables_length'),
pages = api.page.info().pages;

if (e instanceof $.Event) {
Expand All @@ -50,22 +51,28 @@
else {
$paging.css('visibility', 'hidden');
}
if (api.page.info().recordsDisplay < 10) {
$dropdown.css('visibility', 'hidden');
}
}
else {
if (config.style === 'fade') {
$paging.stop().fadeTo(speed, 1);
}
else {
$paging.css('visibility', '');
$dropdown.css('visibility', '');
}
}
}
else if (pages <= 1) {
if (config.style === 'fade') {
$paging.css('opacity', 0);
$dropdown.css('opacity', 0);
}
else {
$paging.css('visibility', 'hidden');
$dropdown.css('visibility', 'hidden');
}
}
};
Expand Down

0 comments on commit e5b02b2

Please sign in to comment.