I have a Page that displays a list of Members in a group, but I need to change the sort of the group members. I though the esiest way would be to add a relation editor to the pagetype with the sort order added via a Data Extension
Here is my extension on Group
class MyGroup extends DataExtension {
static $many_many_extraFields = array(
'Members' => array(
'SortOrder' => "Int"
)
);
}
On the Page I have the following:
if($this->GroupID != 0 && Permission::check("APPLY_ROLES")) {
$group = Group::get()->byID($this->GroupID);
$fields->addFieldsToTab("Root.Members", array(
GridField::create(
"Members",
"Members",
$group->DirectMembers(),
GridFieldConfig_RelationEditor::create()->addComponents(
new GridFieldSortableRows('SortOrder')
)
)
));
}
When I try to sort the Members I get an error
Uncaught SS_DatabaseException: Couldn't run query:
UPDATE "" SET "SortOrder" = 1 WHERE "" = 12 AND "" = 18
I'm not sure why GridField isn't getting the Columns