tom-select
tom-select copied to clipboard
add limit_display plugin

@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
items
option, defaulting to the word 'items', in addition to the existinglimit
option, whereby one could less vague as to what the items were, e.g.,items: 'woozles'
would result in8 woozles selected
being displayed. - While the normal style of a plugin is to assign and use
self
, you're 100% arrow functions here; you always know whatthis
is, so I think you can just skip theself
bit 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 whatthis
is. Best thing ever, IMO. - The 4 separate calls to
addEvent
could be handled by afor...of
loop, 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