0

I read this questions:

Move element within parent from iframe Use jquery inside GWT jsni

but still i have a problem with my code:

private native void graveUpFromIframe() /*-{               
    $entry(function () {                           
        var target = $wnd.$("body", $wnd.parent.document);
        var source = $wnd.$("#bpml-editor-popup");
        source.appendTo(target);
        return 0;                                         
    });                                                   

}-*/;                                                     

After click application open the simple PopupPanel but when app work inside iframe I would like to move this panel to the parent window. At this moment my code does not work and I have no exceptions at log/gwt debug window.

//EDIT: missing # in jQuery selector but problem still exist.

Community
  • 1
  • 1
Koziołek
  • 2,791
  • 1
  • 28
  • 48

1 Answers1

1

It seems like you have a typo in your selector, probably you have to add the hash character to this line, otherwise you are selecting elements by tag <bpml-editor-popup> which I think is not the case.

$wnd.$("#bpml-editor-popup");

BTW, If you dont use jQuery for importing 3party jQueryplugins, I would use gwtquery because you use java for doing all this stuff so as you dont have to use JSNI, you can debug, trace errors, selectors perform better, and the the final code of your app is pretty smaller.

EDITED:

If you want to wrap your code with $entry you have to call to the function returned, so add () to your block:

$entry(function(){})();
Manolo Carrasco Moñino
  • 9,723
  • 1
  • 22
  • 27