Closed vhanahrni closed 8 years ago
By the control definition in the single mode there is always one (single) button that is selected. What is your case when you need all buttons to be unselected in the single mode?
I'm not sure to get your question. Using single mode is useful as I trigger click those buttons. In this case, trigger click one button always select this one, and always unselect other one.
You say "In single mode there is always one single button that is selected". Yes and with data-selected="true" you can define the button to be selected by default.
But actually, there is always one button selected, even if all buttons have data-selected="false".
What is needed here is to have all buttons unselected by default.
For example, if you use select sort, when there is no option selected, there is no sort. There is not one option selected by default, or only in the case where you use data-selected on one of this option.
I thought that using data-selected="false" on all buttons will unselect all buttons by default. But no. There is always one button selected. And it appears that this is always the first one in the group.
I don't think that this is a bug. I think that this is more the result of your logical while writing this plugin and this could be part of further enhancement. Actually, I think that the only solution is to not use data-mode="single" and to use data-mode="" instead. And to trigger click the current selected button before trigger click an other. This to avoid multiple selected buttons. Then it will work as I need.
I think that your case is reasonable because sort buttons control in single mode should behave like radio buttons control (which can be initially unchecked). So the issue is fixed - please download https://raw.githubusercontent.com/no81no/jplist/master/dist/js/jplist.sort-buttons.min.js Also It's not necessary to define data-selected="false" on all buttons, they are unchecked by default.
Thanks. Does the reset action uncheck all sort buttons ?
It should. You're welcome to check this :)
ok thanks
I've made a Plunker demo showing you some features like toggle and cascading. Sorry it's not in a "plugin state", but hope it can help you for futur work.
(sorry It's not update with your last jplist.sort-buttons.min.js)
Thank you! Please close this issue if it's OK.
all my buttons have data-selected="false" but by default, the first button of each sort-buttons-group is selected. I use data-mode="single". Even the reset button select the first button of each sort-buttons-group, instead of remove sorting.