Skip to content

Commit b03821d

Browse files
author
Marc TEYSSIER
committed
Merge pull request #24 from marcteyssier/3.1
Add feature to push to top the pagination
2 parents 72b1600 + 1e307b5 commit b03821d

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

js/evolugrid.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,12 @@
584584
}
585585
}
586586

587-
$this.append(pager);
587+
if(descriptor.paginationTop) {
588+
$this.prepend(pager);
589+
}
590+
else {
591+
$this.append(pager);
592+
}
588593

589594
// Finally, let's enable buttons again:
590595
if (descriptor.filterFormSubmitButton) {

src/Mouf/Html/Widgets/EvoluGrid/EvoluGrid.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ class EvoluGrid implements HtmlElementInterface{
153153
*/
154154
private $countTarget;
155155

156+
/**
157+
* If is the pagination to the top of the evolugrid
158+
*
159+
* @var bool
160+
*/
161+
private $paginationTop = false;
162+
156163
/**
157164
* URL that will be called in Ajax and return the data to display.
158165
*
@@ -480,12 +487,35 @@ public function toHtml() {
480487
descriptor.onResultShown = '.$this->onResultShown.';
481488
';
482489
}
490+
if($this->paginationTop !== null) {
491+
echo '
492+
descriptor.paginationTop = '.$this->paginationTop.';
493+
';
494+
}
483495
echo '
484496
$("#'.$id.'").evolugrid(descriptor);
485497
});
486498
})(jQuery);
487499
</script>
488500
';
489501
}
502+
503+
/**
504+
* return bool
505+
*/
506+
public function getPaginationTop()
507+
{
508+
return $this->paginationTop;
509+
}
510+
511+
/**
512+
* If is the pagination is displayed to the top of the evolugrid
513+
* @param bool $paginationTop
514+
*/
515+
public function setPaginationTop($paginationTop)
516+
{
517+
$this->paginationTop = $paginationTop;
518+
return $this;
519+
}
490520

491521
}

0 commit comments

Comments
 (0)