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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[solved] HasManyComplexTableField > increasing default number of items viewable


Reply

4 Posts   1250 Views

Avatar
bennettpr

21 July 2009 at 11:25am (Last edited: 23 July 2009 8:07am), Community Member, 37 Posts

Hi all,

I'm using HasManyComplexTableField to manage 'bookings'.
The default datagrid view (similar to this one: http://tinyurl.com/lsper6) defaults to 'pages' of 10 items each.

Is there any way to alter this default amount to, say, 30 items?

Any help / advice appreciated.

Paul

Avatar
ChrisBryer

23 July 2009 at 2:07am Community Member, 95 Posts

you can do it with the 'setPageSize' method. Here's an example.

$vidField = new HasManyComplexTableField(
         $this,
         'MyVideos',
         'DOVideoFile',
         array(
            'VideoTitle' => 'Title'
         ),
         'getCMSFields'
      );
      $vidField->setAddTitle('a Video');

      $vidField->setPageSize(20);

Avatar
bennettpr

23 July 2009 at 8:08am Community Member, 37 Posts

Thanks Chris,

Ironically I found this this morning by checking properties in complexFieldTable.php and then extending my model in the exact way you suggested.
Works a charm.

:)
Paul

Avatar
bennettpr

23 July 2009 at 8:09am Community Member, 37 Posts

You also seem to be able to edit the pageSize property directly eg:

$vidField->pageSize = 20;

Paul