Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Set default page size


Go to End
Reply

12 Posts   2279 Views

Avatar
rob.s

9 September 2010 at 2:07am Community Member, 78 Posts

Hi,

is there an other possibility to change the default page size of DOM than changing the line:

protected $per_page = "10";


in DataObjectManger.php ?

Greetz,

Robert

Avatar
UncleCheese

9 September 2010 at 2:09am 4085 Posts

$yourDOM->setPageSize(50);

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
rob.s

9 September 2010 at 2:26am (Last edited: 9 September 2010 2:28am), Community Member, 78 Posts

Hi UncleCheese,

thanks for your fast reply.
This method does not work for me:

if i use this method, the pulldown in the right bottom corner, where the number of displayed items can be changed, does not work anymore (using FileDataObjectManager and ManyManyDataObjectManager)

I use the DOM from SVN trunk and SS 2.4.1

Kind regards,

Robert

Avatar
UncleCheese

9 September 2010 at 2:41am 4085 Posts

What does "doesn't work" mean?

You can update the values in that dropdown with $yourDOM->setPageMap(), BTW..

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
rob.s

9 September 2010 at 3:02am (Last edited: 9 September 2010 3:05am), Community Member, 78 Posts

Hi Uncle,

$manager->setPerPageMap( array('25', '50', '75') );

works like a charm ......

sry for not explaing what happens exactly ...

if i use

$manager->setPageSize(20);

the selected value inside DOM is '10'. And if i change this value, no event (reload) is fired. Nothing happens.
(no JS Error is shown in Firebug)

BTW the DOM is used inside ModelAdmin

Thx for your help,

Robert

Avatar
UncleCheese

9 September 2010 at 3:10am 4085 Posts

Ok, so using setPageMap() fixed the issue?

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
rob.s

9 September 2010 at 3:34am Community Member, 78 Posts

Hi Uncle,

this is OK for me ....

Too bad the code

$manager->setPageSize(20);

does not work for me..

Thanks a lot for your time and help,

Robert

Avatar
rob.s

10 September 2010 at 6:25pm Community Member, 78 Posts

but FileDataObjectManager is ignoring the setting

$manager->setPerPageMap( array('25', '50', '75') );

The Dropdown is correctly populated with the values 25, 50, 75, All

But there are only 10 records displayed on load ....

Go to Top