Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and Drop Checkbox can't be selected #90

Closed
vixen1975 opened this issue Mar 21, 2016 · 4 comments
Closed

Drag and Drop Checkbox can't be selected #90

vixen1975 opened this issue Mar 21, 2016 · 4 comments
Labels

Comments

@vixen1975
Copy link

I have a dataobject connected to a page and I can not make the checkbox select to allow drag and drop in the CMS.

The Dataobject has a field called 'SortOrder' (int), the page it is on has:

public function getCMSFields(){ $fields = parent::getCMSFields(); $conf=GridFieldConfig_RelationEditor::create(10); $conf->addComponent(new GridFieldSortableRows('SortOrder')); $gridField = new GridField("Staff Members", "Staff Members", $this->StaffMembers(), $conf); $fields->addFieldToTab("Root.StaffMembers", $gridField); $fields->removeByName('ContentPanels'); return $fields; }

Other pages in the site work no problems, just this one does not seem to work. I can't see any errors anywhere. I have tried adding a new field for the sort with a different name, and it also does not work. Do you have any ideas on what could be causing this?

Silverstripe 3.2, Sortable Grid Field dev-master downloaded via composer

@UndefinedOffset
Copy link
Owner

What type of relationship are you managing your data object on is it a has_many or a many_many? If it's a many_many your sort order column must be in a many_many_extraFields declaration rather than the object being managed.

@vixen1975
Copy link
Author

It is just a has_many. This is what I just can't get, this page and the data object are so simple. I have way more complex pages with data objects working just fine.

I downloaded the module again and also updated the CMS to 3.2.3 (only just handed the site over to the client, so don't want to update to 3.3 as it looks a little different), but no luck.

@vixen1975
Copy link
Author

I'm having a brain-dead patch... There was a space in the name of the gridfield.

This:
$gridField = new GridField("Staff Members", "Staff Members", $this->StaffMembers(), $conf);

should be
$gridField = new GridField("StaffMembers", "Staff Members", $this->StaffMembers(), $conf);

Thanks for looking though!

@UndefinedOffset
Copy link
Owner

Haha all good been there many times myself glad I could help even if it wasn't the end solution ;). As a tip there is a way to set the relationship name without the GridField's name matching. See the "Overriding the default relationship name" section in the read me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants