Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » SS3 Display Submissions table

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

Page: 1
Go to End
Author Topic: 486 Views
  • merrick_sd
    Avatar
    Community Member
    95 Posts

    SS3 Display Submissions table Link to this post

    I have a custom Form and it is saving data to a table called 'ContactSubmissions'

    Question: How can i display these in the admin area?

    Trying to get this to work using silverstripe 3.

    can Datagrids be display only?

    Attached Files
  • merrick_sd
    Avatar
    Community Member
    95 Posts

    Re: SS3 Display Submissions table Link to this post

    answering my own questions again

       function getCMSFields()
       {
          $fields = parent::getCMSFields();
       
          $fields->addFieldToTab("Root.OnSubmission", new TextField('Mailto', 'Email submissions to'));   
          $fields->addFieldToTab("Root.OnSubmission", new HTMLEditorField('SubmitText', 'Text on Submission'));
          
          
          $gridFieldConfig = GridFieldConfig_RecordViewer::create();
          $gridfield = new GridField("ContactSubmission", "Submissions", ContactSubmission::get(), $gridFieldConfig);
          $fields->addFieldToTab('Root.Submissions', $gridfield);
             
          
          return $fields;   
       }

    }

    I'd like to include an export to csv button next is that possible anyone? GridField_ActionProvider?

  • rohitbanerjee
    Avatar
    Community Member
    7 Posts

    Re: SS3 Display Submissions table Link to this post

    Don't know if you already got the answer, if not then rewrite your code as below:

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab("Root.OnSubmission", new TextField('Mailto', 'Email submissions to'));
    $fields->addFieldToTab("Root.OnSubmission", new HTMLEditorField('SubmitText', 'Text on Submission'));

    $gridFieldConfig = GridFieldConfig_RecordViewer::create()->addComponents(
          new GridFieldToolbarHeader(),
          new GridFieldSortableHeader(),
          new GridFieldFilterHeader(),
          new GridFieldDataColumns(),
          new GridFieldPaginator(),
          new GridFieldExportButton()
       );
    $gridfield = new GridField("ContactSubmission", "Submissions", ContactSubmission::get(), $gridFieldConfig);
    $fields->addFieldToTab('Root.Submissions', $gridfield);

    return $fields;
    }

    I hope this should get you started ...

    486 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.