Search code examples
gwtgquerygwtquery

Assigning ID to a widget using GQuery


I need to wrap a widget with an ID, so I used GQuery to do that, like so:

GQuery g = $(signupButton);
g.id("signupButton");

Now I need to get the instance of the actual Button or Widget using the GQuery object, is that possible?

Will the g.get(0) return the wrapped instance of that Button/Widget?


Solution

  • use the widget() method

    Button b = g.widget();
    
    //later if you want to query your button via its id
    Button b = $("#signupButton").widget()
    

    Julien