Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

"Filterable inside custom select" widget's placeholder is being taken into a count #7396

Closed
0xMarK opened this issue May 13, 2014 · 4 comments

Comments

@0xMarK
Copy link

0xMarK commented May 13, 2014

I had used the code from here: http://demos.jquerymobile.com/1.4.2/selectmenu-custom-filter/
But placeholder was still in the filtering results. So I fixed the problem with this line of code:

$.mobile.filterable.prototype.options.children = "> li:not(:jqmData(placeholder='true')), > option, > optgroup option, > tbody tr, > .ui-controlgroup-controls > .ui-btn, > .ui-controlgroup-controls > .ui-checkbox, > .ui-controlgroup-controls > .ui-radio";

The main thing here is: > li:not(:jqmData(placeholder='true'))

I propose to use my value of children for "mobile.filterable" widget. (line no.13631 jquery.mobile-1.4.2.js)

See the results: http://jsfiddle.net/WqpnA/

P.S. please make a standard component with this behavior. So developers won't have to write a lot of code from widget "Filterable inside custom select"...

@0xMarK 0xMarK closed this as completed May 13, 2014
@0xMarK 0xMarK reopened this May 13, 2014
@jaspermdegroot
Copy link
Contributor

@0xMarK

Thanks for reporting the problem you ran into. I suggest we change the demo a little bit so it has a placeholder as well and we show how to set option children when you call the filterable widget.

I am not in favor of integrating the behavior in the widget, because it doesn't fit in our goal to simplify our widgets.

@slavap
Copy link

slavap commented May 14, 2014

It's not fixed completely, there is another bug. I've opened issue #7405
Also this functionality should be added into widget or additional widget created (it's needed quite often, and "goal to simplify our widgets" has not to be applied here IMO).

@0xMarK
Copy link
Author

0xMarK commented May 15, 2014

@slavap I totally agree. In my mobile project I use it 4 times! It annoys much to write that bunch of code everytime I need it :(

jQuery Mobile could use some kind of modifier like that:

<select data-filterable="true">

@gabrielschulhof
Copy link

@slavap and @0xMarK this is already on our radar.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants