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

API Ability to configure paging for assets / pages
This commit is contained in:
Ingo Schommer 2014-04-28 23:06:47 +12:00
commit 66919ed0cc
2 changed files with 19 additions and 3 deletions

View File

@ -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
@ -152,7 +160,7 @@ JS
new GridFieldSortableHeader(),
new GridFieldFilterHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(15),
new GridFieldPaginator(self::config()->page_length),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm(),

View File

@ -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 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(15)
new GridFieldPaginator(self::config()->page_length)
);
if($parentID){
$gridFieldConfig->addComponent(