Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9842 closed bug (invalid)

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);

Change History (3)

comment:1 Changed 9 years ago by Scott González

Component: ui.coreui.button
Owner: set to 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.

comment:2 Changed 9 years ago by trac-o-bot

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!

comment:3 Changed 9 years ago by jamie_pate

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

Note: See TracTickets for help on using tickets.