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] Remove limit from gridfield list


Reply


3 Posts   286 Views

Avatar
Bereusei

Community Member, 94 Posts

31 January 2014 at 9:39pm

Hey guys,

has anyone an idea how to remove the limit of gridfield list? Normally a gridfield list shows only 20 records or so.
I found also a few links on internet about GridField_DataManipulator and something from Willr:
https://github.com/silverstripe/silverstripe-framework/pull/2294

But I can´t get it work.

$config = GridFieldConfig_RelationEditor::create();
$config->addComponent(new GridFieldPrintButton());
$config->addComponent(new GridFieldDeleteAction());

$WorkField = new GridField(
   'JobWorktimes',
   $WorkFieldTitle,
   $this->JobWorktimes()->sort('Date', 'ASC')->limit(null),
   $config
);

Avatar
martimiz

Forum Moderator, 1132 Posts

2 February 2014 at 2:35am

I don't think you can actually remove the limit, the GridField depends on the GridFieldPaginator and the GridFieldPaginator doesn't seem to let you set the number of pages to 0 (zero) or otherwise remove the limit. For me, I'm not sure about removing the limit altogether - I wouldn't want to load thousands of records in a single GridField :(

But if you're sure the number won't grow that far, I guess there's nothing against setting the number of items to 100 or 400 or...

$config = GridFieldConfig_RelationEditor::create(100);

Avatar
Bereusei

Community Member, 94 Posts

3 February 2014 at 3:00am

Thanks a lot, martimiz. This is what I've been looking for.
In my case it's unlikely to get more than 30 records, but for the usability it's better to see more records, otherwise you quickly overlook some records. Thanks again!