Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Set default page size

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 2095 Views
  • rob.s
    Avatar
    Community Member
    78 Posts

    Set default page size Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Set default page size Link to this post

    $yourDOM->setPageSize(50);

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

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Set default page size Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Set default page size Link to this post

    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

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Set default page size Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Set default page size Link to this post

    Ok, so using setPageMap() fixed the issue?

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

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Set default page size Link to this post

    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

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Set default page size Link to this post

    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 ....

    2095 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.