Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default option not selecting #146

Closed
yanickrochon opened this issue Apr 9, 2013 · 5 comments
Closed

Default option not selecting #146

yanickrochon opened this issue Apr 9, 2013 · 5 comments
Assignees

Comments

@yanickrochon
Copy link

First, this is a very nice plugin!

And here's the issue that I'm having. I have the widget created with these options :

$("#selectElement").selectBoxIt({
    theme: "jqueryui",
    autoWidth: false,
    nativeMousedown: true,
    defaultText: "Select an option"
});

The element looks like this

<select id="selectElement">
    <option value="1">One</option>
    <option value="2">Two</option>
</select>

The problem is that the first option is already selected (but is not shown as the default text is displayed) and when selecting it, the "change" event is never fired. To actually fire an even for the first option, I need to select the second option, then select the first option. However this is problematic as there must be only one event that needs to be fired.

I could trick this by inserting an empty option and adding showFirstOption: false. But if the expected behaviour could happen, it would be preferable.

Edit

I just saw the option-click event, would it break anything if this event would become an alias to the change event? To me, this is essentially the same. Or at least if a default text is showing and is replaced by the option value. Just a thought.

@ghost ghost assigned gfranko Apr 10, 2013
@gfranko
Copy link
Owner

gfranko commented Apr 10, 2013

I'm glad you are enjoying the plugin so far!

I am leaning towards triggering the change event if the defaultText is being used. I am going to release a new version of SelectBoxIt tomorrow, so I will let you know when this is implemented!

Note: To me, the option-click event is not the same thing as the change event since the option-click event will be triggered regardless of whether the value changes.

@gfranko
Copy link
Owner

gfranko commented Apr 11, 2013

@yanickrochon Just to let you know, the next release has been pushed to early next week!

@yanickrochon
Copy link
Author

Good to hear that!

@sactrack
Copy link

I have just run into this same issue this afternoon. The fix will be much appreciated

@gfranko
Copy link
Owner

gfranko commented Apr 27, 2013

This should now be fixed in the latest release!

@gfranko gfranko closed this as completed Apr 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants