bootstrap-select icon indicating copy to clipboard operation
bootstrap-select copied to clipboard

Search is not working for strings produced from numbers like "4730"

Open ni8mr opened this issue 10 years ago • 2 comments

My OS is - Ubuntu 15.04 LTS and my browser is - Mozilla Firefox 44.0.

I have a select tag like this -

<div class="col-sm-10">
    <select class="form-control selectpicker show-tick" title="Select post-code..." id="post-code" data-live-search-placeholder="Search desired post-codes here" data-live-search="true">
    </select>
</div>

Which is populating from a JSON with these options -

<option data-tokens="4730" value="0">4730</option>
<option data-tokens="4731" value="1">4731</option>
<option data-tokens="4732" value="0">4732</option>

And the search option is not working for such values like 4730, 4731 and 4732. All of these values are populating as string.

For live test, you can check here - http://ni8mr.github.io/gpsl-ui/. You have to follow the selection hierarchy. First country, than division, district, sub-district and than post-codes will be available.

ni8mr avatar Mar 22 '16 14:03 ni8mr

bootstrap-select is not checking for and casting data-tokens that contain all digits to a string, so it throws .toUpperCase is not a function

shotolab avatar Mar 22 '16 15:03 shotolab

Ok. I have solved it by adding an extra string with the value of data-tokens attribute. Thanks @shotolab for help. I am closing this issue now. But the developers of this plug-in may want to look into this issue. Something should be done for dealing with such cases.

ni8mr avatar Mar 23 '16 18:03 ni8mr