-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Styling of added checkbox incorrect when in controlgroup #3496
Comments
you are correct. I have tried your code in jsfiddle. It does not work. Not even with the 'trigger' or 'page' methods |
Yes, here is a Gist to reproduce this (with a bookmarklet to run it): You need to trigger the "create" event, that's missing in the example above. But even if you do so (like in my example), the old checkboxes still have the ui-corner-bottom css class. Tobias |
I think this is still an outstanding bug that needs to be fixed. I tried you code, even adding
It does not work in Firefox, safari, chrome or IE. |
Same problem here. Will this be fixed or is there a workaround? |
@tigbro - Is this a bug in jQM or Angular? Can't quite tell from this thread. If it's on our end, could you post a test page using latest? Template using latest here: http://jsbin.com/agewuy/edit |
Hi, Anyway, the issue is in jquery mobile, not in angular nor in my adapter. As far as I can see, the problem is the following: By the way, it would be great to turn Tobias |
Thanks @tigbro. Mind creating issues for making thoe into real widgets if there isn' already one? I agree we should give that a look. |
hi @tigbro You are right about the cause of the problem and that means it might only require a minor change to make this work. By adding the classes you mentioned (and ui-controlgroup-last) to the list of classes that have to be removed we can use the current controlgroup function to refresh a controlgroup as well. Here is a fiddle that loads a version of the JS in which I made the change: http://jsbin.com/agayas/11/ I don't think controlgroup needs to become a 'real' widget because it is always used in combination with another widget (button, checkboxradio or selectmenu). So it is more like an extension of those. I am in favour of a grid widget! It would be great when the grid/block classes are added by the framework like it is done for navbars so you can dynamically inject a new block. @offsky [Update: changed link to new version of fiddle after relocating JS file] |
This line in my previous comment makes no sense: "Maybe we can make it work this way that when you refresh those widgets the framework checks if they are wrapped in a controlgroup and, if so, trigger controlgroup() on that element." Sorry. Refreshing a button, checkboxradio or selectmenu means updating its state. No reason to refresh the controlgroup corner styles after that. It would only apply after you used trigger("create") to inject a new button. So we could look into a way to make that event trigger the controlgroup function on the parent element with data-role controlgroup |
Fixes jquery-archive#3496 - Styling of added checkbox incorrect when in controlgroup
Is this supposed to be resolved? I still get the same effect with 1.1.1. |
Not particularly nice but it works: function workaround($controlgroup) {
$controlgroup
.controlgroup()
.trigger("create")
.find("label, label .ui-btn-inner")
.removeClass("ui-btn-corner-all ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-controlgroup-last ui-shadow")
.end()
.find("label:first, label:first .ui-btn-inner")
.addClass("ui-corner-top ui-controlgroup-first ui-shadow")
.end()
.find("label:last, label:last .ui-btn-inner")
.addClass("ui-corner-bottom ui-controlgroup-last ui-shadow");
} To be called after dynamic modification of the control group. |
Bummer, this bug still exists in 1.2 Any news when it will get fixed?? |
@klemensz @dotnetwise - Can you provide a test page that shows this is still an issue? |
Sure, here it is! The same doesn't work for dynamic swap of radio-buttons controlgroup as well. Generally speaking this is painly hard and contra-intuitive. You never know what method, with what arguments and on which selector to apply! jqmDocs really needs a new page with all the methods on the same page, with their options, usage and examples. |
@dotnetwise Thanks for reporting a problem with the jQuery Mobile docs (although maybe deserved a more suitable expression). We're currently working on the jQuery Mobile API docs which will be similar to the jQuery UI API docs (http://api.jqueryui.com), which I hope will satisfy your request. In the mean time, please note that we're always happy to improve the documentation and we welcome contributions via Pull Requests on that matter. |
OK, so, if this wasn't fixed, I'll reopen it, because #5241 will fix it if merged. |
Why was this closed? I still find two issues:
So still, data-type attribute cannot be changed, even though you change the attribute itself or you do $element.jqmData("type", "horizontal"); Is there any other way you can change the $element.controlgroup("refresh") works as expected, if you hack the _setType method and make it public, but that's really not desired: $.mobile.controlgroup.prototype.setType = $.mobile.controlgroup.prototype._setType; and then later you call it $element.controlgroup('setType', $element.attr("data-type")); |
12 days old and still nothing? |
The issue was closed because the problem was fixed. You can now add a checkbox to a controlgroup, call the controlgroup's If you find issues, please file them separately. For example, the first issue you mention above is indeed present. We intend to address the issue before the next release of jQuery Mobile. The second issue is invalid. If you consult the API documentation for the jQuery UI widget factory's option() method, you will find that, since "type" is an option of the controlgroup widget, you must call |
If you programmatically add a new checkbox to a controlgroup of existing checkboxes, the styling is incorrect. It does not merge the borders with the adjacent checkboxes.
Example: http://jsfiddle.net/JwWpX/1/
The text was updated successfully, but these errors were encountered: