Reputation: 14821
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.
What is wrong with my code?
Upvotes: 0
Views: 60
Reputation: 6319
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
).
Upvotes: 2