-
Notifications
You must be signed in to change notification settings - Fork 64
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
Shift to select Multiple Items at once #62
Comments
Yep, great feature. The |
Shift button globally (excel, other apps) is being utilized to multi select items. So may be we can think about incorporating it for selecting all items in between. |
Yea I know. But this library works a little bit different. I mean how would that work if you keep the extended selection mode (currently shift) where items are not selected right away but only selected when you release the mouse button. I find this actually pretty useful. The problem is that, you don't want all items selected in between when you want to use this extended mode. So how would you differentiate between those two selections? I think if we want this, then we have to fundamentally re-work the selection modes and how this lib works. The way it is currently implemented, it would clash with the feature you suggested. But I totally agree, that this is a useful feature. Maybe I should streamline the behavior with how OS's do this, or other tools like Excel. |
Also, on a Mac you cannot select one, press shift, select another item and all items in between are selected, at least if you are not in the list view. I am not sure how Windows does this. I'd say this is not really common to have both behaviors on shift. @timdeschryver What do you think? |
I find |
Well I think that really depends on the use case and might also be a personal preference. I am not sure if this should be the default though. Asking for input from @timdeschryver on this one. One solution could be to have both but one of the behaviors is hidden behind a flag. So the way the lib handles selection right now would be the default and you could enable the proposed feature with a flag called Any other ideas? |
Or maybe not a flag but specify the behavior in the config that is passed to the |
+1 |
I created my own implementation for this. Add a click listener on the list item:
Add clickhandler to component class:
I've taken my Ubuntu "Files" app as an example. When you click an item and shift + click later, all items in between are selected. But when you shift + click again, notice that the first item you clicked is memorized. The selection always starts with the item you clicked without shift last. In my example, the item object has the index as a property. But you could also pass handleClick the index from the ngFor loop. I've tried performing a deselectItems for all indexes outside the range, but for some reason I need to perform clearSelection. But it works. This works together with the shift + drag as well. |
So there was another request (#87) for this feature and I think we should really go forward with this and add it to the library. Is anyone willing to work on this and send a PR? That'd be awesome, because right now I am quite busy, but I can try to find some time for it. This shouldn't be too difficult and I would go for a solution similar to how this works on Windows. Basically overload the Sounds good? |
Sounds good. Please consider how Windows / Ubuntu implement this: When you click an item and shift + click later, all items in between are selected. But when you shift + click again, notice that the first item you clicked is memorized. The selection always starts with the item you clicked without shift last. |
Yep, makes sense. Thanks! |
I have just pushed a PR that introduces the range selection via |
This is now implemented in latest master. I ll cut a release soon. I am awaiting one outstanding PR and then I ll publish a new version. You can already check it out on https://d3lm.github.io/ngx-drag-to-select/. |
Usecase:
Shift
button.Shift button
.All of the in-between items should be selected.
The text was updated successfully, but these errors were encountered: