Bootstrap select - scroll to selected value - javascript

I'm using bootstrap select (http://silviomoreto.github.io/bootstrap-select/) in my project and I want to achieve this: if I have many options in my select, whenever I open the menu, I want it to be scrolled somehow that my selected option is visible. Something like the select elements on http://jsfiddle.net/
Any ideea if that is possible?

Related

Is there a way to preload selected options on multiple chosen.js select boxes?

I have 10 forms with 5 chosen.js select boxes in each form group. When the page loads I want to load the chosen select boxes with options which have set on another select box, which is hidden from view.
The idea is that the user can deselect the options they don't want, and update the form.
There's a challenge in assigning the correct options to the correct chosen select but what I'm trying to do now is get the already selected options to show.
An example of what it would look like is near the top of the Chosen page. It appears when the page loads 'Sloth Bear' and 'Polar Bear' are already pre-populating their select box.
I've tried chosen:update but my understanding is that it only updates the possible options you can select, not what I'm wanting. I've also tried manually inserting a DOM node into the chosen input, but that wasn't working either.
So is what I'm trying possible? Or is it just an example on the website?

Select2.js with multiple tags and not dropdown icon?

In Select2.js, by default there is a select dropdown box and a dropdown icon to make it intuitive for the user that it is a dropdown and not just an input box.
When we make the select dropdown box with multiple tags enabled, the dropdown box looks more like an input text box. basically the dropdown icon is missing.
Please refer - https://select2.github.io/examples.html
So to add the dropdown icon, i could add it in the select2.js file. But i think it is not a good idea. Any other easier or better way to get the dropdown icon for multi - select select2 js dropdown box?
As the documentation says, when you are using tags, it will become an input box. Select is only for single selection, and Textbox is for multiple selection, a.k.a. tags. :) This is by design.
The best alternate is to use placeholders, which can tell the users that it is a multiselect autosuggest:
$(element).select2({
placeholder: "Start typing..."
});

select box with multiple values turning on and off

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.

combobox with checkbox and a Filter in a web solution

I want to do a combobox, but my user can select more than one option, so, it will be usefull if I do a combobox with Checkbox.
But this combobox with checkbox is bound from my database, so I need to put a filter inside the combobox with checkbox.
How can I do that via Jquery, or ASP.NET/C# ?
I tryied this one but I need to put a filter.
You can use a <asp:CheckBoxList with on top of her a TextBox, and then you bind the checkboxlist using as filter what is typing on the TextBox.
Also if you place your CheckBoxList inside a div with limited width/height, and scroll enable, you have what you ask.
The menu opening, is simple open close of the div, with some delay.

How to display the pulldown button only

I am creating a customize combobox and want to use the default pulldown button used on <select> element. The combobox is composed of a textbox, a pulldown button and somewhat a table element containing the list. Everything is working except for displaying dropdown button.
Note that I want to refrain from using any background image for the button. I want to use the default dropdown button.
How can I make use of the dropdown button?
Maybe you could make a <select> element, then, using positioning in your stylesheet, cover it with the text field. If you position the textfield right, you should show only the pulldown button from your <select>.

Categories

Resources