Skip to main content

Search and Top Navigation

#4293 closed bug (fixed)

Opened March 07, 2009 03:45AM UTC

Closed May 12, 2010 03:50PM UTC

Last modified May 20, 2010 11:14AM UTC

Ctrl + Click on selected list item does not deselect

Reported by: managingmeals Owned by:
Priority: major Milestone: 1.8.2
Component: ui.selectable Version: 1.7
Keywords: Cc:
Blocked by: Blocking:
Description

You can use ctrl and a mouse click to select items that are non-

adjacent. However if you try to click a selected item while holding

control it does not deselect it. This is how one would expect it to function as this is how windows explorer (and i think its the same on mac).

A sample is windows explorer. Make your selection either with ctrl to

select individual items or a lasso for multiple items, or a

combination of both. After you do that you can deselect whatever you

want and keep the rest selected by holding ctrl and and click a

selected item.

Maybe this is already possible and im not seeing it or its a bug? I don't see any documentation of it, or a sample of it.

Please add this feature, if its not already added.

Thanks

Attachments (0)
Change History (9)

Changed March 09, 2009 08:02AM UTC by rdworth comment:1

milestone: TBD1.8

Changed March 19, 2009 09:31PM UTC by Cloudream comment:2

milestone: 1.8TBD
resolution: → fixed
status: newclosed

fixed in new selectable

Changed April 30, 2010 02:07PM UTC by jjones comment:3

I'm using the latest version of jQuery along with the most recent version of the UI, and I'm not seeing an resolution to this issue.

I've tried it myself to no avail, and it also doesn't even work on your own demo page found here: http://jqueryui.com/demos/selectable/

This is a frustrating issue when you have a large list of items that users are selecting from, as if they happen to select one they didn't mean to, they'll have to start all over from the beginning to deselect the undesired item.

Changed May 01, 2010 10:38AM UTC by rdworth comment:4

resolution: fixed
status: closedreopened

I don't know why this issue was closed as the new selectable refactor is still in development. See http://wiki.jqueryui.com/Selectable

Changed May 12, 2010 03:00PM UTC by jaysoo comment:5

I made a small change to _mouseStart function to get this to work as described using the metaKey (Ctrl/Cmd).

My fork: http://github.com/jaysoo/jquery-ui/blob/df06075a331e47ac85f63c3f47a15d5df5f399bf/ui/jquery.ui.selectable.js

this.selectees.filter('.ui-selected').each(function() {
	var selectee = $.data(this, "selectable-item");
	selectee.startselected = true;
	if (!event.metaKey) {
		selectee.$element.removeClass('ui-selected');
		selectee.selected = false;
		selectee.$element.addClass('ui-unselecting');
		selectee.unselecting = true;
		// selectable UNSELECTING callback
		self._trigger("unselecting", event, {
			unselecting: selectee.element
		});
	}
});

Changed May 12, 2010 03:11PM UTC by rdworth comment:6

Replying to [comment:5 jaysoo]:

I made a small change to _mouseStart function to get this to work as described using the metaKey (Ctrl/Cmd). My fork: http://github.com/jaysoo/jquery-ui/blob/df06075a331e47ac85f63c3f47a15d5df5f399bf/ui/jquery.ui.selectable.js
> this.selectees.filter('.ui-selected').each(function() {
> 	var selectee = $.data(this, "selectable-item");
> 	selectee.startselected = true;
> 	if (!event.metaKey) {
> 		selectee.$element.removeClass('ui-selected');
> 		selectee.selected = false;
> 		selectee.$element.addClass('ui-unselecting');
> 		selectee.unselecting = true;
> 		// selectable UNSELECTING callback
> 		self._trigger("unselecting", event, {
> 			unselecting: selectee.element
> 		});
> 	}
> });
> 

Commented on GitHub "When unselecting is triggered, the property key needs to be 'unselecting' not 'selecting'. Compare lines 116, 202, 215."

Changed May 12, 2010 03:35PM UTC by jaysoo comment:7

Replying to [comment:6 rdworth]:

Commented on GitHub "When unselecting is triggered, the property key needs to be 'unselecting' not 'selecting'. Compare lines 116, 202, 215."

My bad, here's the new commit: http://github.com/jaysoo/jquery-ui/blob/13238fa835084e88aa10a7442db9f9214a67c86b/ui/jquery.ui.selectable.js

$(event.target).parents().andSelf().each(function() {
	var selectee = $.data(this, "selectable-item");
	if (selectee) {
		var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
		selectee.$element
			.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
			.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
		selectee.unselecting = !doSelect;
		selectee.selecting = doSelect;
		selectee.selected = doSelect;
		// selectable (UN)SELECTING callback
		if (doSelect) {
			self._trigger("selecting", event, {
				selecting: selectee.element
			});
		} else {
			self._trigger("unselecting", event, {
				unselecting: selectee.element
			});
		}
		return false;
	}
});

Changed May 12, 2010 03:50PM UTC by rdworth comment:8

resolution: → fixed
status: reopenedclosed

Fixed in 5b4c04a and e780583

Thanks jaysoo!

Changed May 20, 2010 11:14AM UTC by rdworth comment:9

milestone: TBD1.8.2