Open vladlep opened 7 years ago
If you use a native select
component, it won't allow you unselect in single selection mode. So is this project.
Only multiple selection mode can unselect and what you need is to make a default option to select instead of unselect option.
Hi,
Thanks for the very fast reply. I thought of adding an extra option in the select like this:
users.unshift({
name: gettext('All users'),
id: ""
})
This would be just great since when I select All users
the id is an empty string, which would then work just great with the API and filtering. The problem is that if I make the id an empty string the selector is initialized to Nothing selected
instead of All users
And when i switch back to All users it shows nothing selected.
It would work if instead of id = "" i would set id = -1 but then i would have to pre-process the data before sending to the server, which is not ideal since I wanted to make generic directive that i can re-use in slightly different ways.
True, however when using angular's select directive it is possible to specify the could be used as 'undefined'. With this directive it is not possible so I believe it is a good idea to have alternative in-built solution.
I've implemented it in a way it is used in ui-select directive: allow-clear="true": https://github.com/lordfriend/nya-bootstrap-select/issues/186
Thanks.
Hi,
I would like my select to have dynamically 2-3 options of users and have the
Nothing selected
option also part of the dropdown always. This way i can renameNothing selected
title toAll users
and in the dropdown you can then select one user or theAll users
options.Now if i select one user i can not go back to Nothing selected (all users).
I could not find in the documentation some tips for this. Is is supported and if so could someone tell me how.
Thanks, Vlad