Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8198297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:55:19+00:00 2026-06-07T05:55:19+00:00

I am trying to integrate the jQuery Masonry library with my GWT project. However

  • 0

I am trying to integrate the jQuery Masonry library with my GWT project. However I cannot make the library to work with the containers and elements generated by GWT. But it does work if I rewrite the generated GWT HTML directly in my HTML page.

This how my GWT EntryPoint looks like

public class Sample implements EntryPoint {

    //In here the text has random lengths to achieve different div blocks to work with Masonry
    private HTML label1 = new HTML("Text..");
    private HTML label2 = new HTML("Text..");
    private HTML label3 = new HTML("Text..");
    private HTML label4 = new HTML("Text..");
    private Image image1 = new Image("images/samsung.jpg");
    private AbsolutePanel hPanel = new AbsolutePanel();

    public void onModuleLoad() {

        DOM.setElementAttribute(hPanel.getElement(), "id", "content");
        image1.setSize("230px", "400px");
        HTML html = new HTML(image1.toString());
        html.setStyleName("item");
        hPanel.add(html);

        label1.setStyleName("item");
        hPanel.add(label1);

        label2.setStyleName("item");
        hPanel.add(label2);

        label3.setStyleName("item");
        hPanel.add(label3);

        label4.setStyleName("item");
        hPanel.add(label4);

        RootPanel.get("wrapper").add(hPanel);

    }
}

I also have a css file declared like this:

#wrapper{
    margin: 0 auto;
    width: 1000px;
}

.item{
    padding: 10px 10px;
    width:230px;
    float: left;
}

This generates the following HTML code:

<div id="wrapper">
            <div id="header">
                <h1>JQuery, Masonry, GWT, GQuery Test</h1>
            </div>

        <div style="position: relative; overflow: hidden;" id="content">
            <div class="item">
                <img src="images/samsung.jpg" class="gwt-Image"
                    style="width: 230px; height: 400px;">
            </div>
            <div class="item" style="">
                Text
            </div>
            <div class="item">text</div>
            <div class="item" style="">text</div>
            <div class="item"><img src="images/samsung.jpg" class="gwt-Image"
                    style="width: 230px; height: 400px;">
            </div>
            <div class="item">text</div>
        </div>
    </div>

And finally in my HTML page I have the jQuery call which looks like this:

    <script type="text/javascript" charset="UTF-8" language="javascript"
src="scripts/jquery-1.7.2.min.js"></script>

        <script type="text/javascript" charset="UTF-8" language="javascript"
src="scripts/jquery.masonry.js"></script>

    <script type="text/javascript" charset="UTF-8">

    $(document).ready(function(){       

        $('#content').masonry();
    });
</script>

When I execute this GWT application the Masonry library will not work and will not render the expected output. However, when I copy the HTML generated by GWT and paste it directly into the HTML page the library will work correctly and will render the expected output.

I followed this tutorial in the Masonry website http://masonry.desandro.com/docs/intro.html . Can somebody point me out what could be the reason why this does not work with the GWT generated HTML??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:55:20+00:00Added an answer on June 7, 2026 at 5:55 am

    At the time of your document ready the entrypoint has not been executed yet. So the DOM is not there yet.

    To avoid this problem you could just use GWTQuery instead or call javascript from gwt signaling your DOM update. This would look something like this:

    JavaScript:

    function domUpdated(){
        //do you jquery stuff here...
    }
    

    GWT:

    private native void tellJavascriptWeAreDone()/*-{
        $wnd.domUpdated();
    }-*/;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to integrate jquery-timepickr on my website, but no matter what version I
I am trying to integrate jquery image slider. But I need to slide the
hi im trying to integrate a jquery datepicker to my codeigniter project.. the problem
I'm trying to integrate jQuery and the Cycle plugin with an existing application. However,
Im trying to integrate Brad Larson's GPUImage framework to my project. The sample code
I'm trying to integrate passport into my nodejs server using connect, but can't seem
I am currently trying to integrate Paypal's MECL in an already existing IOS project
I am trying to integrate JQuery tabs with my WordPress blog, to replace old
i am trying to intergrate the jquery progress bar but i am getting issues.
Okay, so I'm trying to integrate the jQuery UI plugin selectable (grid), and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.