Permalink
Browse files

API Ability to configure paging for assets / pages

ref: CWPBUG-143
  • Loading branch information...
tractorcow committed Apr 28, 2014
1 parent baff7f1 commit 0285322049ecbcf077de80326c1b243a8fd5e727
Showing with 19 additions and 3 deletions.
  1. +10 −2 code/controllers/AssetAdmin.php
  2. +9 −1 code/controllers/CMSMain.php
@@ -16,6 +16,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
@@ -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 0285322

Please sign in to comment.