meteor-select2
meteor-select2 copied to clipboard
Dropdown/clear images not showing up and config options not taking affect.
I'm not sure what I'm doing wrong but the select2 images I listed above and many of the config options aren't working for me like placeholder, and allowClear. The "width" config option works however. I would greatly appreciate any help. Here is the relevant code:
Template.contactsNew.rendered = ->
# Initialize select boxes
$('#status-select').select2
allowClear: true
placeholder: 'Select a status'
width: '100%'
label Status
select#status-select(name='status')
option(value='active') Active
option(value='inactive') Inactive
option(value='prospect') Prospect
option(value='calling') Calling
I actually just saw this in the console:
Resource interpreted as Image but transferred with MIME type text/html: "http://localhost:3000/select2x2.png".
Do you know why it would be doing this?
having the same problem. would appreciate some help/tip on how to resolve this.
@thomasspiesser I actually fixed this but it wasn't ideal. I took the image and and put it in the /public folder of the project. For the placeholder, I added an empty "option" to the top of the select. That fixed everything. I'm not sure why Meteor doesn't find the assets of the packages sometimes. I've had this happen on two other packages now.
@sturoid thanks mate! that fixes the problem even though it isn't ideal.
@thomasspiesser Glad I could help!
I seem to have this happening too in Meteor 1.0.3.1 ... any relationship to https://github.com/meteor/meteor/issues/2602?
Thanks for linking that. It could definitely be the problem.
Yes, that seems to be the problem. A call to e.g.
http://localhost:3000/packages/natestrauser_select2/lib/select2/select2.png
works. Should the image references in the css files be hardcoded? If that is the solution, I could submit a quick PR.
In the meantime (waiting on stable Select2 4.0 for nate's official Atmosphere package), you can just download abhishekbatra's fork as a .zip, copy its contents into your app's packages/
folder and then meteor add select2
. It solves this issue, at least.
Interesting thing is that some of the urls are rewritten (at least for me looking at the chrome devtools), like:
.select2-search-choice-close { (..) background: url('packages/natestrauser_select2/lib/select2/select2.png') right top no-repeat; }
Even though the css file points directly to select2.png. I don't understand that. It would be great if this (rewrite) was a default behavior for css files.
Overwriting the css in a custom files feels wrong - it might break if the original css file changes.
For now I'm gonna copy the files to public/ ..