-
Notifications
You must be signed in to change notification settings - Fork 125
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
FIX #355 Sorting in paginated lists #418
base: 4.0
Are you sure you want to change the base?
Conversation
Thank you for submitting this change. You may need to reset your commits after retargetting the PR. |
If a many_many relation with the sort in an many_many_extraField has an item draged to another page the resulting sort is wrong. This was caused by the handleMoveToPage function not respecting the original sort of the list.
8e070a1
to
fbf7b86
Compare
Ok, I've changed it to the 4.0 branch. |
Thanks for doing that. Here's my class for the "taxonomy group" and the through class that the reproduction steps say I need: use SilverStripe\ORM\DataObject;
class TaxonomyGroup extends DataObject
{
private static $many_many = [
'Terms' => [
'through' => TermThrough::class,
'from' => 'Group',
'to' => 'Term',
],
];
} use SilverStripe\ORM\DataObject;
use SilverStripe\Taxonomy\TaxonomyTerm;
class TermThrough extends DataObject
{
private static $db = [
'Sort' => 'Int',
];
private static $has_one = [
'Group' => TaxonomyGroup::class,
'Term' => TaxonomyTerm::class,
];
} And here's how I generated the records: use SilverStripe\Taxonomy\TaxonomyTerm;
if (TaxonomyGroup::get()->count() === 0) {
$group = TaxonomyGroup::create();
$group->write();
for ($i = 0; $i < 200; $i++) {
$term = TaxonomyTerm::create(['Name' => $i, 'Sort' => $i]);
$term->write();
$group->Terms()->add($term);
}
} With that setup I can't actually reproduce the original bug (with or without the PR). @mfendeksilverstripe can you please test this PR and check it resolves the problem for you in CMS 5.2+? |
Hey @GuySartorelli I did test this change but it doesn't seem to be fixing the issue. I suspect that we might have two scenarios here to test: many_many_extra_field with sort and many_many_through with sort. I tested the latter. This is my local test setup:
For me it reorders different items compared to what I selected. For example, I attempted to move item 15 to the next page and instead it moved item 3 to the last page. If your still having trouble with the setup please let me know and I can assist you further as we can use one of my projects as a testing ground. |
@johannesx75 Sounds like there's still some work to don on this PR, please amend the PR as per the comment above. |
Description
If a many_many relation with the sort in an many_many_extraField has an item dragged to another page the resulting sort is wrong. This was caused by the handleMoveToPage function not respecting the original sort of the list.
Issues
Pull request checklist