JavaScriptObject listing for a gwt widget

Can I learn how to distinguish JavascriptObject from JSNI in gwt as gwt CUstomWidget

CustomWiget widget = (CustomWidget) javascriptObjectFromJSNI; //does not work

+4
source share
2 answers

You can use CustomWidget as the return type of your JSNI method. An example at http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOverlay.html#example-json does this with a client (which extends JavaScriptObject):

 private native Customer getFirstCustomer() /*-{ return $wnd.jsonData[0]; }-*/; 

If your CustomWidget is really a widget (and not JavaScriptObject), then you are probably looking for something completely different: in this case you will have to write a wrap() method, for example com.google.gwt.user.client.ui.Button.wrap()

+2
source

You cannot pass an ELement to a widget. You can use GQuery to help you in this case.

GQuery $ (element) .widget () will provide you with the GWT widget you are looking for on your DOM.

+3
source

Source: https://habr.com/ru/post/1335711/


All Articles