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

display ALL dataobjects per page as default


Reply


5 Posts   893 Views

Avatar
janulka

Community Member, 80 Posts

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!

Avatar
Howard

Community Member, 215 Posts

16 September 2011 at 10:34pm

Just set $yourManager->setPageSize( '999' );

Avatar
UncleCheese

Forum Moderator, 4096 Posts

17 September 2011 at 2:18am

Howard FTW!

Avatar
wainui

Community Member, 56 Posts

1 November 2011 at 2:55pm

Edited: 01/11/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');

Avatar
pbz

Community Member, 5 Posts

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.