-
Notifications
You must be signed in to change notification settings - Fork 61
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 sorting for ModelAdmin is not working #125
Comments
Are you getting any error? Does the allow sort checkbox show up? Also remember that |
I can confirm the sorting does not work. I use Silverstripe 4.5.0. The "Allow sort" checkbox shows up, I can sort DataObjects, but once I untick the checkbox / leave the ModelAdmin, everything returns to the original order. |
@janherman do you have DataObject's |
@UndefinedOffset Yes, I had As it turned out, the problem was I set my sort field as translatable (I use Silverstripe Fluent for translations). I needed slightly different order of DataObjects in each language and I thought this could work. If I disable translation for sort field, sorting works again. |
AH that'll do it, because of how fluent works and how sortable grid field works they're in compatible with each other. You'd need to update the localized tables which sortable grid field of course doesn't know about. In theory it would be a relatively simple extension to do this, if I can find the time I can try to put something together that may work for you if you want. But it may not be for a few days :( |
Thanks, @UndefinedOffset! Please do not worry about it right now. Because the number of DataObjects in my case is relatively small, I added simple numeric field to each of them to determine the order. Not so elegant, but suitable for the purpose. If you find time for the extension one day, it will be great of course. :-) |
I'm using Silverstripe 4.
I've created a DataObject that will call using ModelAdmin.
I've tried your guide on how to implement it but I'm afraid it is not working
https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/ModelAdminExample.md
My DataObject already have
private static $default_sort = 'SortOrder';
DistributorAdmin.php
The text was updated successfully, but these errors were encountered: