7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » display ALL dataobjects per page as default
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 583 Views |
-
display ALL dataobjects per page as default

16 September 2011 at 9:22pm
I have ImageDataObjectManager, with images, all working nice.
But DOM displays 10 objects per page in CMS as default, how do I change this particular ImageDOM to display all items per page as default?
Thank you!
-
Re: display ALL dataobjects per page as default

16 September 2011 at 10:34pm
Just set $yourManager->setPageSize( '999' );
-
Re: display ALL dataobjects per page as default

1 November 2011 at 2:55pm Last edited: 1 November 2011 2:57pm
hmmm... not sure if that works (does it uncle?) didnt seem to for me.. although I noticed the code is there in the DOM.php
I managed to do the same using code below.. not sure if correct way.
$manager->setPerPageMap('All');
$manager->setPageSize('All'); -
Re: display ALL dataobjects per page as default

27 April 2012 at 6:18pm
Here's a more complete solution.
// Show All by default
$manager->per_page = "9999";
$manager->setPageSize(9999);
if(isset($_REQUEST['ctf']['RelationName'])) $manager->setPageSize($_REQUEST['ctf']['RelationName']['per_page']);Be sure to replace RelationName with the actual name of the relation in question.
Explanation:
Only using setPageSize (line 3) means the drop down no longer works, so after setting it to default you set it based on the request value (line 4). Setting per_page (line 1) is necessary for the dropdown to have All selected in the dropdown by default. It is necessary to make a small hack of changing the decleration of per_page from protected to public in DataObjectManager.php for this last bit to work. Everything else works fine without the hack.
| 583 Views | ||
|
Page:
1
|
Go to Top |

