tom-select
tom-select copied to clipboard
add limit_display plugin
trafficstars
@craigh Thanks for this; I'm in the process of investigating a move away from another solution, and this helps greatly with integration into the existing design, which tends to look odd if the select input can grow to infinite height. A few hopefully helpful suggestions:
- Consider adding an
itemsoption, defaulting to the word 'items', in addition to the existinglimitoption, whereby one could less vague as to what the items were, e.g.,items: 'woozles'would result in8 woozles selectedbeing displayed. - While the normal style of a plugin is to assign and use
self, you're 100% arrow functions here; you always know whatthisis, so I think you can just skip theselfbit and always usethis. I'm new here, not sure if this is just a preferred style, but, well, arrow functions mean never being confused about whatthisis. Best thing ever, IMO. - The 4 separate calls to
addEventcould be handled by afor...ofloop, and then you don't needaddEvent.
for (const type of ['input', 'keyup', 'blur', 'update']) {
this.control_input.addEventListener(type, updateDisplay);
}
This pull request has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days