backbone.picky icon indicating copy to clipboard operation
backbone.picky copied to clipboard

Added support to configure a limit on how many selections can be made

Open stnor opened this issue 11 years ago • 1 comments

I added support to limit the number of selections that can be made in a MultiSelect. Not sure if this is useful to anyone else, but here goes.

stnor avatar Jan 26 '14 22:01 stnor

I have wondered a while ago if there was a use case for a "before:select" event, and couldn't think of anything which would require it. Now here it is.

As an alternative to hard-coding this specific behaviour into Backbone.Picky, a limit could be implemented in an onBeforeSelect event handler. That kind of solution would be a little more flexible. There'd have to be a cancelSelect flag of some kind, which an event handler can set, presumably on an options object which MultiSelect.select has access to. Just a thought.

hashchange avatar Jan 27 '14 20:01 hashchange