0
votes

I have a website running silverstripe 3.6.1 with blog module 2.4.

I want to add drag and drop reordering to the blogposts Gridfield with GridFieldSortableRows and I'm not sure how to approach this.

Note: I have extended Blog and BlogPost, I have News and NewsPost, so I can add customizations of my own.

I am just looking at

$gridField = new BlogFilter_GridField(
    'ChildPages',
    $this->getLumberjackTitle(),
    $pages,
    $this->getLumberjackGridFieldConfig()
);

I have tried to add ->addComponent(new GridFieldSortableRows('ID') after the Lumberjack config but doesn't seem to be working ( I also added SortID field to the NewsPost).

Any help is appreciated.

EDIT1: I'm not sure it's ok but what I've done so far, I have created a NewsFilter.php, and I removed the BlogFilter from News and replaced with NewsFilter.php so I can cleanly edit.

1

1 Answers

0
votes

Try something like this:

$gridFieldConfig = $this->getLumberjackGridFieldConfig();
$gridFieldConfig->addComponent(new GridFieldSortableRows('SortID')

$gridField = new BlogFilter_GridField(
    'ChildPages',
    $this->getLumberjackTitle(),
    $pages,
    $gridFieldConfig
);