fastselect icon indicating copy to clipboard operation
fastselect copied to clipboard

Is there anybody using fastselect ? and share knowledge here

Open zdiodic opened this issue 6 years ago • 5 comments

Is there anybody using fastselect ? and share knowledge here

many question not answered here

zdiodic avatar May 30 '18 09:05 zdiodic

Not many people using it. However, It looks like a good plugin.

vohrahul avatar Jun 02 '18 19:06 vohrahul

I've started using it for a new project, impressed so far, but I'm just having an issue with the placeholder text, in that it always defaults to the first option (/)(;,,;)(/)

latchy avatar Oct 12 '18 17:10 latchy

@Latchy I'm having that same issue as well with the placeholder text. Were you able to find a solution?

nathanhoeller avatar Mar 01 '19 15:03 nathanhoeller

@Latchy , I did a little more digging and I found a solution.

The issue is that the fastselect script searches the select options for one with the attribute "selected: true" (line 120 in fastselect.js). By default, this option is set to the first option in a list that's not disabled. In a non-fastselect situation, you could do the trick of adding "disabled selected" to the select option on top, but with fastselect that doesn't help since it seems to ignore the "disabled" status when it generates disabled options as a "fstResultItem".

So, to bypass this I had to change the value of the select element to an empty string prior to fastselect running.

For my situation, the code looked like this:

$("#projectList").val(""); // clear value selected by default to make way for placeholder

$("#projectList").fastselect({
    placeholder: 'Select a Project',
    searchPlaceholder: 'Search...'
});

I hope that helps. Let me know if you have any questions.

nathanhoeller avatar Mar 01 '19 18:03 nathanhoeller

@pezmo

Hi there, thanks for the update. I moved to using the select2 plugin, hacked the CSS and found it to work just as well, if not better? Though, I tried so many plugins I forgot the issues I was having with either at the time entirely.

If you need some assistance with that plugin, let me know.

https://select2.org/

latchy avatar Mar 04 '19 11:03 latchy