0

I am developing a SilverStripe project. I am new to SilverStripe. Now, I am using LeftModelAdmin to display the list of data which has a menu item in the admin panel. But my list view is not showing all the columns. Instead, it is displaying only one column. This is what I have done so far.

This is my model class

namespace {

    use SilverStripe\ORM\DataObject;

    class ContactFormSubmission extends DataObject
    {
        private static $db = [
            'Name' => 'Varchar',
            'Email' => 'Varchar',
            'Message' => 'Text',
        ];
    }
}

This is my ModelAdmin class for the model

namespace {

    use SilverStripe\Admin\ModelAdmin;

    class ContactFormSubmissionAdmin extends ModelAdmin
    {
        private static $menu_title = 'Enquiries';

        private static $url_segment = 'enquiries';

        private static $managed_models = [
            ContactFormSubmission::class,
        ];

        private static $summary_fields = [
            'Name' => 'Name',
            'Email' => 'Email',
            'Message' => 'Message',
        ];
    }
}

When I view the list view in the admin panel, I only see one column in the admin panel as in the screenshot below.

enter image description here

What is wrong with my code?

halfer
  • 18,701
  • 13
  • 79
  • 158
Wai Yan Hein
  • 9,841
  • 21
  • 103
  • 244

1 Answers1

2

summary_fields configuration belongs on the model, not the model admin.

Try moving:

private static $summary_fields = [
    'Name' => 'Name',
    'Email' => 'Email',
    'Message' => 'Message',
];

to your model (ContactFormSubmission).

Scopey
  • 6,120
  • 1
  • 20
  • 33