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

ComplexTableField on the frontend


Go to End
Reply


2 Posts   1170 Views

Avatar
netnerd85

Community Member, 42 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
netnerd85

Community Member, 42 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);
}