Skip to main content

Search and Top Navigation

#9842 closed bug (invalid)

Opened February 20, 2014 01:18AM UTC

Closed March 07, 2014 08:49AM UTC

Last modified March 07, 2014 05:32PM UTC

buttonset methods fail when dom is modified causing 'cannot call methods on button prior to initialization' exception

Reported by: jamie_pate Owned by: jamie_pate
Priority: minor Milestone: none
Component: ui.button Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

I ran into this issue while using https://github.com/angular-ui/ui-utils/tree/master/modules/jq

Due to the dynamic nature of angularjs and ng-repeat the buttonset contents would sometimes be modified. Once the ui-jq directive called $(elm).buttonset('refresh') it would throw '''cannot call methods on button prior to initialization; attempted to call method 'widget''''

After much research I determined that the radioGroup() function was not checking to make sure that all the buttons it found were in fact buttons before calling jqueryui methods on them.

My work-around simply removes the constraint via Monkey-patching:

(function($) {
    'use strict';
    var orig_button = $.fn.button;
    $.fn.button = function(options) {
        if (!$(this).is(':ui-button')) {
            orig_button.call(this);
        }
        orig_button.call(options);
    };
})(jQuery);
Attachments (0)
Change History (3)

Changed February 20, 2014 04:50PM UTC by scottgonzalez comment:1

component: ui.coreui.button
owner: → jamie_pate
status: newpending

Why do you have radios in the set that aren't buttons? Please provide a reduced test case showing how this situation would occur.

Changed March 07, 2014 08:49AM UTC by trac-o-bot comment:2

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed March 07, 2014 05:32PM UTC by jamie_pate comment:3

I'm unable to duplicate it manually, my effort can be found here: http://jsfiddle.net/34Cpk/3/

Perhaps this bug is better raised here: https://github.com/angular-ui/ui-utils/tree/master/modules/jq

https://github.com/angular-ui/ui-utils/issues/196

Some peculiar interaction is going on with the rendering of angular templates with ng-repeat