jquery-bar-rating
jquery-bar-rating copied to clipboard
Not able to use 0 value for rating
I have the definition like below. I use -1 as no selection in the back-end and use knockout binding. I want to use a rating as 0 (0-5 rating) and clicking on a selected value should deselect all (that is why I have <option value=""></option>
) . I tried with initialValue, allowEmpty etc. and none of them is helping. The only way I can make it work is set 0 option value to something else (e.g. ).
Is there a way to use 0 rating?
<select data-bind="value: rank" class="barrating"> <option value=""></option> <option value="-1"></option> <option value="-99">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select>
This worked for me, I basically added a hidden option with 0 to my select and added allowEmpty the options. Not sure if it's the best approach, but it worked for what I needed.
e.g:
<select class="rating" data-current-rating="0" name="rating">
<option hidden="" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
Options
allowEmpty: true,
emptyValue: 0,
Sorry, that is not helping. If I don't have <option value=""></option>
it will not let me unselect
Are there any update on this?
any update on this?