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

Multi-check functionality only works forward and not backwards #979

Closed
garretthyder opened this issue Dec 13, 2018 · 2 comments
Closed

Multi-check functionality only works forward and not backwards #979

garretthyder opened this issue Dec 13, 2018 · 2 comments
Labels
[Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature is broken.
Milestone

Comments

@garretthyder
Copy link

garretthyder commented Dec 13, 2018

Hello,

The multi-select function of checkboxes only works going down the page and not back up. By the multi-select function I speak on when you check a checkbox and then skip a few rows and check another checkbox then all checkboxes in between become checked. The code for this;
https://github.com/GlotPress/GlotPress-WP/blob/43bb5383e114835b09fc47c727d06e6d3ca8114e/assets/js/translations-page.js#L47-L68

This only works from top to bottom, it would be nice if it worked in reverse as well so if you check a box low in the page and then go up and check another then all boxes in between get checked.

How it functions going down the page;
Multi-Check Downwards

Going in reverse this illustrates how it doesn't check the boxes in between;
Failed Multi-Check Upwards

Hope that makes sense,
Cheers

@garretthyder garretthyder added the [Type] Enhancement A suggestion for improvement. label Dec 13, 2018
@toolstack
Copy link
Contributor

Seems like an easy fix, just add the following after first/last are calculated:

if( first > last ) { swap = last; last = first; first = swap; }

Of course there is the note above that the code was taken from WP, so perhaps it's already been fixed there?

@toolstack
Copy link
Contributor

Just took a look, they have fixed it in WP:

			if ( 0 < first && 0 < last && first != last ) {
				sliced = ( last > first ) ? checks.slice( first, last ) : checks.slice( last, first );
				sliced.prop( 'checked', function() {
					if ( $(this).closest('tr').is(':visible') )
						return checked;

					return false;
				});
			}

@toolstack toolstack added [Type] Bug An existing feature is broken. and removed [Type] Enhancement A suggestion for improvement. labels Dec 13, 2018
@toolstack toolstack added this to the 3.0 milestone Dec 13, 2018
@toolstack toolstack added the [Status] In Progress Tracking issues with work in progress label Dec 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature is broken.
Projects
None yet
Development

No branches or pull requests

2 participants