Permalink
Browse files

Merge pull request #1003 from tractorcow/pulls/3.1-configurable-paging

API Ability to configure paging for assets / pages
  • Loading branch information...
2 parents 072e0d9 + 0285322 commit 66919ed0cc81430498b5ad11ef84d18f0a5baf50 @chillu chillu committed Apr 28, 2014
Showing with 19 additions and 3 deletions.
  1. +10 −2 code/controllers/AssetAdmin.php
  2. +9 −1 code/controllers/CMSMain.php
@@ -17,6 +17,14 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider{
private static $tree_class = 'Folder';
/**
+ * Amount of results showing on a single page.
+ *
+ * @config
+ * @var int
+ */
+ private static $page_length = 15;
+
+ /**
* @config
* @see Upload->allowedMaxFileSize
* @var int
@@ -150,9 +158,9 @@ public function getEditForm($id = null, $fields = null) {
$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldSortableHeader(),
- new GridFieldFilterHeader(),
+ new GridFieldFilterHeader(),
new GridFieldDataColumns(),
- new GridFieldPaginator(15),
+ new GridFieldPaginator(self::config()->page_length),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm(),
@@ -27,6 +27,14 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
private static $subitem_class = "Member";
+ /**
+ * Amount of results showing on a single page.
+ *
+ * @config
+ * @var int
+ */
+ private static $page_length = 15;
+
private static $allowed_actions = array(
'buildbrokenlinks',
'deleteitems',
@@ -726,7 +734,7 @@ public function ListViewForm() {
$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
- new GridFieldPaginator(15)
+ new GridFieldPaginator(self::config()->page_length)
);
if($parentID){
$gridFieldConfig->addComponent(

0 comments on commit 66919ed

Please sign in to comment.