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.

General Questions /

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

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

ComplexTableField on the frontend


Go to End


2 Posts   1338 Views

Avatar
jaybee

Community Member, 49 Posts

14 December 2010 at 10:55pm

I'm trying to get a ComplexTableField to work on the frontend using the example code here but it's not working for me. I've only managed to get "(none)" to display. Does anyone have a full working example?

I have a User DataObject that has Tasks. I would like the User to be able to manage their Tasks on the front end.

Avatar
jaybee

Community Member, 49 Posts

16 December 2010 at 2:42am

Edited: 16/12/2010 2:43am

I managed to get the table with data to display using the code below but the add/edit and delete functions take me to "Page Not Found". Are there some functions or templates that I need to overwrite to get it to work? Is it tied into the Members system or something?

function getTasks() {		
	$tableField = new ComplexTableField(
		$this,
		'Tasks',
		'Task',
		array(
			'Title' => 'Title'
		),
		'getPopupFields'
	);

	$tableField->setParentClass(false);

	$fields = new FieldSet(
		new HiddenField('ID', ''),
		$tableField
	);

	$actions = new FieldSet(
		new FormAction('Go', 'Go')
	);

	return new Form($this, 'EditForm', $fields, $actions);
}