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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

[SOLVED] SS 3: set custom column in GridField


Go to End


3 Posts   1523 Views

Avatar
Stephan

Community Member, 55 Posts

20 January 2014 at 1:32pm

Hi experts,
I want to show a custom generated content of a column in my GridField.
The content has to be the result of a query of another model but depending on the value of another column in the same GridField.
I know that this is solved normally with relations, but I can't use this in this case, because the value is not related to the ID.

How can I achieve this?

TIA Stephan

Avatar
Willr

Forum Moderator, 5523 Posts

20 January 2014 at 4:15pm

Simply add a new field name in summary_fields and a method of the same name to your model. GridField will handle calling the method.

Avatar
Stephan

Community Member, 55 Posts

20 January 2014 at 10:13pm

Thanks very much :-)
Now it works!