Closed jeffwhitfield closed 11 years ago
I haven't tried it myself, but be believe you can embed a GridField into the front-end of the site. GridField isn't just for the back-end CMS. However, it might take a bit of hacking around to get it working. If you also include the Sortable GridField add-on module, that should give you drag and drop sorting of documents in the front-end. Good luck!
If you can figure this out, please write some documentation for others and submit it as a pull request to the module.
Hrm. Couldn't we just override the methods that are being use for the default include Documents in the template? Surely there's a way to enhance it to accept a field to sort by, right? That said, still having fun trying to figure out which methods control the output. Durp!
Here's what's odd. I have the SortableGridField module installed and the DocumentSort value is getting stored right...but it's not being used at all in the "include Documents" output. :P
Major, major durp! Figured it out! All you have to do is simply create a method in your controller using the getManyManyComponents method. Something like this works:
public function DocumentList(){
$list = $this->getManyManyComponents('Documents')->sort('DocumentSort');
return $list;
}
Then just use a Control loop in your template with DocumentList. Done! :)
Hi there! Love the module! However, I'm banging my head on my desk trying to figure out how to sort the documents in a different order on the frontend. Any way to do this?
Thx a bunch! :)