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

ComplexTableField on the frontend


Reply

2 Posts   936 Views

Avatar
netnerd85

14 December 2010 at 10:55pm Community Member, 42 Posts

I'm trying to get a ComplexTableField to work on the frontend using the [url=http://doc.silverstripe.org/complextablefield#getting_it_working_on_the_front_end_not_the_cms]example code here[/url] 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

16 December 2010 at 2:42am (Last edited: 16 December 2010 2:43am), Community Member, 42 Posts

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);
}