Selectable and single select (or no mouseDrag).
|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Selectable and single select (or no mouseDrag).Is there a way to disable the drag select in a jQuery.UI.Selectable list? I only want single selections, and want to turn off the ability to select multiple items. Thanks Jack --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery-ui@... To unsubscribe from this group, send email to jquery-ui+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Selectable and single select (or no mouseDrag).Sounds far simpler than anything the selectable plugin is designed for. How about:
$("#myList > *").click(function() { $(this).toggleClass("selected").siblings().removeClass("selected"); }); - Richard On Tue, Mar 10, 2009 at 2:10 PM, Jack <jackambrose@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery-ui@... To unsubscribe from this group, send email to jquery-ui+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Selectable and single select (or no mouseDrag).Hello,
your code fragment does not seem to work for me. Could you please instruct me where exactly I have to put it in my document? That's how I tried it: <script type="text/javascript"> $(document).ready(function() { $("#selectable").selectable({ // click: function(){ $(this).toggleClass("selected").siblings().removeClass("selected"); }, stop: function(){ var result = $("#select-result").empty(); $(".ui-selected", this).each(function(){ var index = $("#selectable li").index(this); result.append(" #" + (index + 1)); }); } // }); }); </script> Thank you very much! Regards, Tom
------BEGIN GEEK CODE BLOCK------
Version: 3.1 GIT/E d- s+:-- a C++ UL++ P+ W+ w M-- PS t+ tv-- b+++ G e* h* r% y? -------END GEEK CODE BLOCK------- |
|
|
Re: Selectable and single select (or no mouseDrag).My code fragment was not meant to be used with selectables, but in place of it:
<script type="text/javascript"> $(document).ready(function() { $("#selectable").children().click(function() { $(this).toggleClass("selected").siblings().removeClass("selected"); }); }); </script> - Richard On Wed, Apr 22, 2009 at 4:18 AM, SexyBeast <johndavies@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery-ui@... To unsubscribe from this group, send email to jquery-ui+unsubscribe@... For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Selectable and single select (or no mouseDrag).Hello!
Not quite, but you were close: Your line: $(this).toggleClass("selected").siblings().removeClass("selected"); is programmatically correct, but refers to the wrong class. It must be 'ui-selected' instead of 'selected'. ( took me ages to find out.. )
So $(this).toggleClass("ui-selected").siblings().removeClass("ui-selected"); works for me. Obviously this has been the problem when I tried it before. (I am a noob to jquery , so it still is a bit confusing) Anyway: thank you very very much for your help! regards, Tom
------BEGIN GEEK CODE BLOCK------
Version: 3.1 GIT/E d- s+:-- a C++ UL++ P+ W+ w M-- PS t+ tv-- b+++ G e* h* r% y? -------END GEEK CODE BLOCK------- |
| Free embeddable forum powered by Nabble | Forum Help |
)