gwtbootstrap / gwt-bootstrap

A GWT Library that provides the widgets of Bootstrap, from Twitter.
http://gwtbootstrap.github.com
405 stars 190 forks source link

After reseted the button, setText of the button will throw exception #361

Open thesadboy opened 11 years ago

thesadboy commented 11 years ago

Code follow:

    public void onModuleLoad()
    {
        final Button btn1 = new Button("aaaa");
        btn1.setLoadingText("Loading");
        btn1.addClickHandler(new ClickHandler()
        {
            @Override
            public void onClick(ClickEvent event )
            {
                btn1.state().loading();
            }
        });
        final Button btn2 = new Button("bbbb");
        btn2.addClickHandler(new ClickHandler()
        {

            @Override
            public void onClick(ClickEvent event )
            {
                btn1.state().reset();
                btn1.setText("cccc");
            }
        });
        RootPanel.get().add(btn1);
        RootPanel.get().add(btn2);
    }

When i click btn2 after clicked btn1, the console will throw the exception of "
com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) @com.google.gwt.dom.client.Node::removeChild(Lcom/google/gwt/dom/client/Node;)([JavaScript object(14)]): Object [object Window] has no method 'removeChild' ", and the text of btn1 will be still "aaaa".
caarlos0 commented 11 years ago

It looks like a Bootstrap buttons plugin exception. Can you try to reproduce it with vanilla js and bootstrap?

Thanks

thesadboy commented 11 years ago

Thanks for your response, but I think there is no method of "setText()" in Bootstrap button plugin. In this case, I've tried to call "reset()" after "setText()", but thrown the same exception.

caarlos0 commented 11 years ago

weird...

rastaman commented 11 years ago

Could you try the latest snapshot with the fix of issue 451 ? I'm pretty sure it should resolve your problem.