The lazy loading example seems to work fine (I tried Wicket 1.4.17, the one
I'm using too).

For some reason 'precondition()' returns false in IE when called from my
app. The code loading the panels is really straight forward. I can't think
of any reason (for now) why the precondition returns false, only in IE, and
even not for all lazyloadpanels.
I have actually no idea where precondition is changed or something - I
checked the js file (wicket-ajax.js) and there the function of the prototype
just returns true (see below). So, precondition it is changed somewhere, for
some reason, and probably something in a javascript-file of wicket that is
called from my code IE doesn't like (other browsers don't complain). What
code can be wrong? Something 'wrong' in the html-files? Style files (which
would be very odd, if you ask me)?

--

Wicket.Ajax.Request.prototype = {
    // Creates a new request object.    initialize: function(url,
loadedCallback, parseResponse, randomURL, failureHandler, channel) {
                this.url = url;
                this.loadedCallback = loadedCallback;
                // whether we should give the loadedCallback parsed response 
(DOM
tree) or the raw string         this.parseResponse = parseResponse != null ?
parseResponse : true;
                this.randomURL = randomURL != null ? randomURL : true;
                this.failureHandler = failureHandler != null ? failureHandler :
function() { };
                this.async = true;
                this.channel = channel;
                this.precondition = function() { return true; } // allow a 
condition
to block request
                // when suppressDone is set, the loadedCallback is responsible 
for
calling         // Ajax.Request.done() to process possibly pendings requests
in the channel.         this.suppressDone = false;
                this.instance = Math.random();
                this.debugContent = true;
        },
--      




2011/7/3 Martin Grigorov <mgrigo...@apache.org>

> Can you check http://wicketstuff.org/wicket/ajax/lazy-loading ?
> This is Wicket 1.5-RC5.1 and it works for me with IE8.
>
> Wicket 1.4.17 at http://wicketstuff.org/wicket14/ajax/lazy-loading
>
> On Sat, Jul 2, 2011 at 5:16 PM, Kurt Sys <kurt....@gmail.com> wrote:
> > Hey all,
> >
> > In IE, I can't get lazyloadpanels to load. I have a webapp with some
> > lazyloadpanels, and none of them loads in IE - in other browsers, there
> is
> > no problem. (Also, the content of an iframe doesn't load, which seems to
> be
> > related, since it is also an ajax-request.) I've been trying both IE 8
> and
> > IE 9 on three different pc's. Can someone give me a clue why it won't
> work
> > in IE? (IE security settings are set to low, scripts etc are
> > enabled/allowed, so I suppose ajax-requests can be performed... if not, I
> > have no clue how to allow ajax in IE.) You may check it out:
> > http://www.tinyleaps.be
> >
> > I've been checking on similar problems with lazyloadpanel in ie, and the
> > problem was known in 2008 (if it's the same, but it looks really
> similar):
> > http://www.mail-archive.com/users@wicket.apache.org/msg18815.html
> > There seems to be a bug report and a 'fixed' status, although it doesn't
> > seem to work out fine for me - the last comment states that the fix is
> not
> > confirmed. Or I am  missing something, which wouldn't really surprise me
> :),
> > or there still something wrong with the precondition stuff and loading
> the
> > panel in IE:
> > https://issues.apache.org/jira/browse/WICKET-1653
> >
> >
> > Ajax debug window (only these three lines):
> > --
> > INFO: Ajax GET stopped because of precondition check,
> >
> url:?wicket:interface=:3:mainpanel:bloglist:1:commentaar::IBehaviorListener:0:
> > INFO: Ajax GET stopped because of precondition check,
> >
> url:?wicket:interface=:3:mainpanel:bloglist:2:commentaar::IBehaviorListener:0:
> > INFO: Ajax GET stopped because of precondition check,
> > url:?wicket:interface=:3:weer::IBehaviorListener:0:
> > --
> >
> > HomePage.html:
> > --
> > [...]
> > <body>
> > <wicket:extend>
> > [...]
> >      <div wicket:id="route" />
> > [...]
> >            <div wicket:id="mainpanel" />
> > [...]
> >            <div wicket:id="weer" class="weer" >&nbsp;
> >            </div>
> > [...]
> >      </div>
> > </wicket:extend>
> > </body>
> > </html>
> > --
> >
> > HomePage.java:
> > --
> > [...]
> >
> > public class HomePage
> >      extends BasePage {
> >
> >   Panel mainPanel;
> >   Label linktekst;
> >
> >
> >   public HomePage() {
> >      this(null);
> >   }
> >
> >
> >   public HomePage(PageParameters pars) {
> > [...]
> >      add(new RoutePanel("route"));
> >
> >
> >      if (pars != null) {
> >         mainPanel = new BlogPanel("mainpanel", pars.getAsInteger("id"));
> >      }
> >      else {
> >         mainPanel = new BlogPanel("mainpanel");
> >      }
> >
> >      add(mainPanel);
> > [...]
> >      add(new AjaxLazyLoadPanel("weer") {
> >
> >         @Override
> >         public Component getLazyLoadComponent(String markupId) {
> >            return new WeerPanel(markupId,
> > reis.getBlogitemList().get(0).getLocation().getName());
> >         }
> >
> >      });
> >   }
> >
> > }
> > --
> >
> > BlogPanel.html
> > --
> > [...]
> >      <wicket:panel>
> > [...]
> >         <ul class="bloglist">
> >            <li wicket:id="bloglist" class="blogitem">
> > [...]
> >                   <div wicket:id="commentaar" />
> >                     </div>
> > [...]
> >            </li>
> >         </ul>
> > [...]
> >      </wicket:panel>
> >   </body>
> > </html>
> > --
> >
> > BlogPanel.java:
> > --
> > [...]
> > public final class BlogPanel
> >      extends Panel {
> >
> >   private static final int ITEMSPERPAGE = 3;
> >
> >   public BlogPanel(String id) {
> >      this(id, 0);
> >   }
> >
> >
> >   public BlogPanel(final String id, final int blogid) {
> >      super(id);
> >
> >      setOutputMarkupId(true);
> >
> > [...]
> >      List<Blogitem> blogitemList =
> >            Q.EM.createNamedQuery("Blogitem.findAll", Blogitem.class).
> >            setHint(QueryHints.REFRESH, HintValues.TRUE).getResultList();
> >
> >      BlogListView blogListView = new BlogListView(
> >            "bloglist",
> >            new ListDataProvider(blogitemList),
> >            ITEMSPERPAGE) {
> >
> >         @Override
> >         protected void populateItem(final Item<Blogitem> item) {
> >
> > [...]
> >            item.add(new AjaxLazyLoadPanel("commentaar") {
> >
> >               @Override
> >               public Component getLazyLoadComponent(String markupId) {
> >                  return new CommentaarPanel(markupId,
> > item.getModelObject());
> >               }
> >
> >            });
> > [...]
> >         }
> >
> >      };
> >
> > [...]
> >      add(blogListView);
> >
> > [...]
> > }
> >
> > abstract class BlogListView
> >      extends DataView<Blogitem> {
> >
> >   BlogListView(String id, ListDataProvider ldp, int i) {
> >      super(id, ldp, i);
> >   }
> >
> > [...]
> >   }
> > }
> > --
> >
> > CommentaarPanel.html:
> > --
> > [...]
> >   <body>
> >      <wicket:panel>
> >         <div wicket:id="commentaarToevoegen" />
> >         <ul>
> >            <li wicket:id="commentaarList" class="commentaar">
> >               <p class="zegt"><span wicket:id="tijdstip" /> - <span
> > wicket:id="commentator" class="schrift commentator" /> laat weten:</p>
> >               <p wicket:id="tekst" class="schrift" />
> >            </li>
> >            <div wicket:id="commentaarNav" class="navigator navigatordown"
> > />
> >         </ul>
> >      </wicket:panel>
> >   </body>
> > </html>
> > --
> >
> > CommentaarPanel.java:
> > --
> > [...]
> > public final class CommentaarPanel
> >      extends Panel {
> >
> >   private Blogitem blog;
> >   private List<Comment> commentList;
> >   private DataView<Comment> commentListView;
> >
> >
> >   public CommentaarPanel(String id, Blogitem blog) {
> >      super(id);
> >
> >      this.blog = blog;
> >
> >      setOutputMarkupId(true);
> >
> >      commentList = blog.getCommentList();
> >      Collections.sort(commentList);
> >      commentListView =
> >            new DataView<Comment>("commentaarList",
> >                                  new ListDataProvider(commentList),
> >                                  5) {
> >
> >               @Override
> >               protected void populateItem(Item<Comment> item) {
> >                  item.add(new Label("tekst",
> > item.getModelObject().getText()));
> >                  item.add(new Label("commentator",
> > item.getModelObject().getName()));
> >                  item.add(new Label("tijdstip",
> > Q.DF.format(item.getModelObject().getTimestamp())));
> >               }
> >
> >            };
> >      add(commentListView);
> >      add(new AjaxPagingNavigator("commentaarNav", commentListView) {
> >
> >         @Override
> >         public boolean isVisible() {
> >            return this.getPageable().getPageCount() > 1;
> >         }
> >
> >      });
> >      add(new CommentaarToevoegenPanel("commentaarToevoegen", this));
> >   }
> >
> >
> >   public Blogitem getBlog() {
> >      return blog;
> >   }
> >
> >
> >   public List<Comment> getCommentList() {
> >      return commentList;
> >   }
> >
> >
> >   public DataView<Comment> getCommentListView() {
> >      return commentListView;
> >   }
> >
> > }
> > --
> >
> >
> > WeerPanel.html:
> > --
> > [...]
> >   <body>
> >      <wicket:panel>
> >         <span wicket:id="locatie" /><br />
> >         <img wicket:id="icoonhuidig" class="weericoon" />
> >         <p>temperatuur: <span wicket:id="temperatuur" />&deg;C<br />
> >         vochtigheid: <span wicket:id="vochtigheid" /><br />
> >         wind: <span wicket:id="wind" /></p>
> >      </wicket:panel>
> >   </body>
> > </html>
> > --
> >
> > WeerPanel.java:
> > --
> > [...]
> > public final class WeerPanel
> >      extends Panel {
> >
> >   private String locatie;
> >
> >   public WeerPanel(String id, String locatie) {
> >      super(id);
> >      this.locatie = locatie;
> >      init();
> >   }
> >
> >
> >   public WeerPanel(String id) {
> >      this(id, "Brugge");
> >   }
> >
> >
> >   private void init() {
> >      Document doc = null;
> >      {
> >         InputStream in = null;
> >         try {
> >            URL xmlUrl = new URL("http://www.google.com/ig/api?weather=";
> +
> > locatie);
> >            in = xmlUrl.openStream();
> >            doc = parse(in);
> >         }
> >         catch (MalformedURLException ex) {
> >            Logger.getLogger(WeerPanel.class.getName()).log(Level.SEVERE,
> > null, ex);
> >         }
> >         catch (IOException ex) {
> >            Logger.getLogger(WeerPanel.class.getName()).log(Level.SEVERE,
> > null, ex);
> >         }
> >         finally {
> >            if (in != null) {
> >               try {
> >                  in.close();
> >               }
> >               catch (IOException ex) {
> >
> > Logger.getLogger(WeerPanel.class.getName()).log(Level.SEVERE, null, ex);
> >               }
> >            }
> >         }
> >      }
> >
> >      String locatieString = "<ongekend>";
> >      String srcicon = "http://www.google.com";;
> >      String temperatuur = "<?>";
> >      String vochtigheid = "<?>";
> >      String wind = "<?>";
> >
> >      if (doc != null) {
> >         locatieString =
> >
> >
>  
> doc.getElementsByTagName("city").item(0).getAttributes().getNamedItem("data").getNodeValue();
> >         NodeList nl =
> > doc.getElementsByTagName("current_conditions").item(0).getChildNodes();
> >         for (int i = 0; i < nl.getLength(); i++) {
> >            Node n = nl.item(i);
> >            if (n.getNodeName().equals("icon")) {
> >               srcicon +=
> > n.getAttributes().getNamedItem("data").getNodeValue();
> >            }
> >            else if (n.getNodeName().equals("temp_c")) {
> >               temperatuur =
> > n.getAttributes().getNamedItem("data").getNodeValue();
> >            }
> >            else if (n.getNodeName().equals("humidity")) {
> >               vochtigheid =
> > n.getAttributes().getNamedItem("data").getNodeValue().split(": ")[1];
> >            }
> >            else if (n.getNodeName().equals("wind_condition")) {
> >               wind =
> > n.getAttributes().getNamedItem("data").getNodeValue().split(": ")[1];
> >            }
> >         }
> >      }
> >
> >      add(new Label("locatie", locatieString));
> >      add(new StaticImage("icoonhuidig", srcicon));
> >      Label temperatuurLabel = new Label("temperatuur", temperatuur);
> >      temperatuurLabel.setRenderBodyOnly(true);
> >      add(temperatuurLabel);
> >      Label vochtigheidLabel = new Label("vochtigheid", vochtigheid);
> >      vochtigheidLabel.setRenderBodyOnly(true);
> >      add(vochtigheidLabel);
> >      Label windLabel = new Label("wind", wind);
> >      windLabel.setRenderBodyOnly(true);
> >      add(windLabel);
> >
> >   }
> >
> >
> >   public static Document parse(InputStream is) {
> >      Document ret = null;
> >      DocumentBuilderFactory domFactory;
> >      DocumentBuilder builder;
> >
> >      try {
> >         domFactory = DocumentBuilderFactory.newInstance();
> >         domFactory.setValidating(false);
> >         domFactory.setNamespaceAware(false);
> >         builder = domFactory.newDocumentBuilder();
> >
> >         ret = builder.parse(is);
> >      }
> >      catch (Exception ex) {
> >         System.err.println("unable to load XML: " + ex);
> >      }
> >      return ret;
> >   }
> >
> > }
> > --
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to