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   1289 Views

Avatar
bennettpr

Community Member, 37 Posts

21 July 2009 at 11:25am

Edited: 23/07/2009 8:07am

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

Community Member, 95 Posts

23 July 2009 at 2:07am

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

Community Member, 37 Posts

23 July 2009 at 8:08am

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

Community Member, 37 Posts

23 July 2009 at 8:09am

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

$vidField->pageSize = 20;

Paul