Wednesday, January 15, 2014

Re: How to adjust a GWT frame height to get no scrollbars (100% of body content)?

And here is the exception-text I get:

uncaught: Exception caught: Exception caught: Exception caught: Exception caught: (TypeError) @xyz.client.views.experimental.FrameViewGwtImpl::setFrameSize(Ljava/lang/String;)([string: 'framename']): Cannot read property 'contentWindow' of null

Am Mittwoch, 15. Januar 2014 13:51:40 UTC+1 schrieb marian lux:
I want to set the frame-height to the height of the content in my frame. So I can display it in mgwt with normal scrolling behavior.
 
The following code is not working:
in my ViewImpl.java:

constructor:
frame = new Frame(some-url/xyz.html");

frame.getElement().setId("framename");
setFrameSize("framename");

.....
.....

JSNI-method in this class
    public native boolean setFrameSize (String id)
    /*-{
            var newheight;
            var newwidth;
       
            if($doc.getElementById){
                newheight=$doc.getElementById(id).contentWindow.$doc.body.scrollHeight;
                newwidth=$doc.getElementById(id).contentWindow.$doc.body.scrollWidth;
            }
       
            $doc.getElementById(id).height= (newheight) + "px";
            $doc.getElementById(id).width= (newwidth) + "px";
            return true;
    }-*/;

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment