Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

ui-refresh with jq-ui="buttonset" causing 'cannot call methods on button prior to initialization' exception #196

@jamie-pate

Description

@jamie-pate

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') (via the ui-refresh mechanism) 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);

I also filed a bug with jquery ui here: http://bugs.jqueryui.com/ticket/9842
but I have been unable to reproduce this bug by hand.
(my efforts so far are here: http://jsfiddle.net/34Cpk/3/ )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions