Gridfield across all pages

38 views
Skip to first unread message

Matthew Bonner

unread,
Mar 16, 2015, 6:55:29 AM3/16/15
to silverst...@googlegroups.com
Does anyone know if there is a way to share a gridfield across all pages?

My previous attempt resulted in a gridfield that had the same data across all pages in the administration area, but the gridfield would not save any new items added.

I'm wondering if it is possible to achieve this without using modules or whether a module is required in order to get this working.

I'm aware that there are modules but it isn't really clear if any work with gridfields or whether they are purely for adding editor content or something else as the documentation isn't really clear on the ones I've seen. So rather than testing all the modules that exist, I guess there will be some here who have already had to do a similar thing and know from experimenting.

Thanks.

wolfv

unread,
Mar 16, 2015, 12:58:13 PM3/16/15
to silverst...@googlegroups.com
I'm not sure if I get your question correct. You want a gridfield that has the same items for every page?
Or you want to have the same gridfield but with page specific items? What you should do is add a page_id column to your gridfield elements and then filter, based on that.

Anyways, the more correct place to ask such a question is, I guess, stackoverflow or the silverstripe forums!

Cheers,

Wolf

Matthew Bonner

unread,
Mar 16, 2015, 1:06:35 PM3/16/15
to silverst...@googlegroups.com
Your first guess was correct, I want a gridfield that has the same items for every page. The forums never seem to get a response from what I've seen on the basis of others posting. SO would be a good place, but there was more than once reason for posting it here, the second reason for posting here was going to be covered after I got the answer as I'm not sure if the second reason applies or not yet, I guess it does, but I'm hoping someone proves me wrong.

Loz Calver

unread,
Mar 16, 2015, 1:38:21 PM3/16/15
to silverst...@googlegroups.com
Perhaps I'm misunderstanding too, but this is pretty simple. You can pass any SS_List instance you feel like to a GridField:

GridField::create(
'AnyFieldNameYouLike',
'Some Title',
MyDataObject::get(),
GridFieldConfig_RecordEditor::create()
)

Martine bloem

unread,
Mar 16, 2015, 3:02:32 PM3/16/15
to silverst...@googlegroups.com
As to never getting a response on the forums - I beg to differ. Not hard to see that in fact most questions do get answered at some point. In StackOverflow hardly any questions remain unanswered as well. And then there is always the IRC channel.

Worth at least a try anyway :)

Martine
--
You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to silverstripe-d...@googlegroups.com.
To post to this group, send email to silverst...@googlegroups.com.
Visit this group at http://groups.google.com/group/silverstripe-dev.
For more options, visit https://groups.google.com/d/optout.

off...@netwerkstatt.at

unread,
Mar 16, 2015, 3:09:02 PM3/16/15
to silverst...@googlegroups.com

Now that ss-helper  bot is publishing all forum posts in IRC it may get more attention and I try to answer where I can.

 

IRC is good for ad-hoc answers, forum / stackoverflow is perfect for questions that can wait a bit and/or need help from the other side of the world.

 

Thanks for that bot ;)

 

Cheers,

 

Werner

Matthew Bonner

unread,
Mar 17, 2015, 5:17:24 AM3/17/15
to silverst...@googlegroups.com
Loz that is exactly what me and another developer tried, but it doesn't save.

Loz Calver

unread,
Mar 17, 2015, 5:32:24 AM3/17/15
to silverst...@googlegroups.com
I’m using that exact code (swapping out the class name, of course) to create a GridField on a page type and it works perfectly. I’d suggest moving this across to the forums with a code example.

Matthew Bonner

unread,
Mar 17, 2015, 6:23:00 AM3/17/15
to silverst...@googlegroups.com
I can see what you've done there, the MyDataObject will return everything, where as we've written it so that MyDataObject is a container which contains fields linking to other classes. This added step of complexity means the way we are doing this won't work the same way as you have done this, so I'll take this over to the forums.

I'll leave my last point for now pending what is said in the forums.
Reply all
Reply to author
Forward
0 new messages