zorab47 / jquery.ui.monthpicker

Monthpicker widget for jQuery UI
http://zorab47.github.io/jquery.ui.monthpicker
MIT License
24 stars 10 forks source link

Change event fires when same month selected #6

Closed peterc1 closed 10 years ago

peterc1 commented 10 years ago

It appears that the picker is firing a change event even when the same month/year is selected in the picker. This can probably be worked around in the onClose handler, but it seems like an issue that's best fixed in the picker code itself. Looks like line 1221 is where a change is needed.

zorab47 commented 10 years ago

Isn't that behavior inline with how Datepicker handles updates?

Here is an example JSFiddle with both Datepicker and Monthpicker.

peterc1 commented 10 years ago

I guess you're right, but it seems out of line with other controls, particularly a textbox, which doesn't generate this event if the contents are edited but not actually changed when the field loses the focus. But I guess it makes sense that this control is consistent with jQuery UI's DatePicker - can't say I agree with it though.

zorab47 commented 10 years ago

I'm flexible on the issue. Could making this change mask a useful event? I suppose the onSelect event is fired anytime a user selection is made, although, it is nice to stay consistent with Datepicker.

peterc1 commented 10 years ago

My issue with it is that I have other UI elements like dropdown lists that don't fire a change if you open the list and end up re-selecting the current selection. And on pages that postback on change events on elements like these, this leaves the page in its current state. With the month picker, and I guess with the date picker too, if the user opens the picker and then decides not to change the value, and closes the picker by clicking on the current date/month, it will cause a postback and reload of the page. It's not a huge deal, just an inconsistency with other standard UI elements. It seems a bit weird to add an option to control this, so its probably best for this control to be consistent with the date picker.