2

I am working on a SilverStripe project. In my project, I am creating a ModelAdmin class to display the custom DataObject. I am also customizing the search/ filter fields by overriding the searchableFields function of the DataObject.

This is my simple searchableFields function of my DataObject class called Item.

public function searchableFields()
{
    return [
        'Title' => [
            'filter' => 'PartialMatchFilter',
            'title' => 'Title',
            'field' => TextField::class,
        ],
    ];
}

I can see the field in the filter form as in the screenshot below.

enter image description here

As you can see in the code, the title field will be mapped to the Title column of the Item data object in the database. But I also want to do some more customization on the search. As you can see, there is a big long search box above the filter form. For example, I want to configure that main search box to search through the Title column. Maybe other columns too. Maybe ID and Title columns. How can I configure that?

scrowler
  • 24,273
  • 9
  • 60
  • 92
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372

0 Answers0