I'm having troubles with SortableJS's selecting system (mainly the MultiDrag plugin). I want to be able to programmaticaly select and deselect the elements that are to be dragged, but also want to disable the built-in click-selecting. In other words, I want to disable the click-to-select functionality of SortableJS AND MultiDrag and only select the items via the provided select and deselect functions. I tried fiddling with the code myself but it's a bit too convoluted for my understanding and I couldn't find where the actual selecting is happening and how the MultiDrag plugin is keeping track of the selected items. Does anyone have experience with this? Thank you.
You need to prevent the deselection on the item clicked.
Eg
$(element).on('pointerup mouseup touchend', function(event){
event.stopPropagation();
});
See https://github.com/SortableJS/Sortable/issues/1612#issuecomment-533777362
Related
For dropdown in google forms, they don't use select control and it is just a combination of div and classes and even the selection option is based on classes. I can't find a way to programmatically select an option as far as I have seen (I tried few things including the click() event but didn’t work).
Any ideas here could be helpful!
Does Settings > Advanced > Restore settings to their original defaults help?
I have a little problem with select2 v2.4.0. I need to show popover with text when user hover one option from the dropdown list. The problem is that I don't see any hover like event which could work with dropdown items. In the previous version of this plugin the event was called "select2-highlight" but it doesn't seem to work now.
I have checked the source to find something similar but without luck. Unfortunately documentation is not complete so I can't check it.
Have you any idea how I can do that?
I use own library for functional testing in PHP, it's based on JsonWireProtocol.
I have an select element selected by id and I need to select 2 options from this element. I know how to select singe element - I just find desired option and click on it. But it's impossible with 2 options as second click deselects first one.
How can I achieve this?
As workaround I send a JavaScript line but I'm not happy with this solution.
From the JsonWireProtocol draft version I understand that Selenium interprets modifier-keys such as ctrl and shift as sticky. http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/keys and code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/keys
So I haven't tested this myself, but it seems to me that you can send a ctrl-keypress, follow by two clicks on the options you want to select, and then another ctrl-keypress to "depress" the ctrl-key.
I've got a select box in a form with multiple="multiple" switched on.
At the moment I can obviously hold Ctrl if I want to select multiple items, but what I really want it the option to just click any i like, and they just get selected or deselected when clicked.
I guess kinda like a whole list of checkboxes, but I really don't want them as checkboxes, I want them all as a dropdown.
Is this even possible? Maybe with jquery?
I think going with checkboxes is not a bad way. Check out http://jqueryui.com/button/#checkbox. Then you can style the buttons like a list with display: block etc.
You can also do something a little different like this: jQuery Sortable - Select and Drag Multiple List Items
The demo shown there works as you requested in an appealing way.
How can a checkbox inside a drop down menu using javascript to be implemented so that every time you click the menu to change situation?
The website you have linked presents a list along this lines: http://jsfiddle.net/XJWkH/
Of course this is just a raw example but basically this is the way the dropdown list on the site works. When you click on a dropdown/submenu element, jQuery adds or removes 'checked' class on that element.
jQuery is the easiest path here. I have used this plugin with great success and have rolled my own as well.
Good luck!