Hi All, I have a table and JS on the page -> when table scrolling in the very down JS function call wicket and label which displayed on the page incremented. All good with FireFox and all good in case with IE if you will pull scrolling down by your mouse. But if you will use your mouse wheel -> wicket will be called twice and label will be incremented twice too.
Java: public class ScrollTableTestPage extends WebPage { private int count = 0; public ScrollTableTestPage() { final DataTable<Contact> table = new DataTable<Contact>("table", // (IColumn<Contact>[]) Arrays.asList(new PropertyColumn<Contact>(Model.of("Name"), "name")).toArray(), // new ListDataProvider<Contact>(generateContacts()), Integer.MAX_VALUE); add(table.setOutputMarkupId(true)); final Label label = new Label("label", new Model<Integer>() { @Override public Integer getObject() { return count; } }); add(label.setOutputMarkupId(true)); add(new AbstractDefaultAjaxBehavior() { @Override protected void respond(final AjaxRequestTarget target) { count++; target.addComponent(label); } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderOnDomReadyJavascript(getCallbackScript().toString()); } @Override protected CharSequence getCallbackScript() { String script = "var div = document.getElementById('div');" // + "var table = document.getElementById('" + table.getMarkupId() + "');" // + "div.onscroll = function(){" // + "var var1 = div.scrollTop;" // + "var var2 = div.clientHeight;" // + "var var3 = table.clientHeight;" // + "if((var1 + var2) == var3){" // + generateCallbackScript("wicketAjaxGet('" + getCallbackUrl() + "'") // + "}" // + "};"; return script; } }); } private List<Contact> generateContacts() { List<Contact> contacts = new ArrayList<Contact>(); for (int i = 0; i < 30; i++) { contacts.add(new Contact("name-" + i)); } return contacts; } private class Contact implements Serializable { private String name; public Contact(String name) { super(); this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } } } HTML: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/"> <body> <wicket:head> </wicket:head> <div class="eXtremeTable" id="div"> <table border="0" cellspacing="0" cellpadding="0" class="tableRegion" width="100%" wicket:id="table"></table> </div> </body> </html> Sorry, this is not exactly a wicket question but maybe someone can help. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IE-call-wicket-twice-from-JS-tp3519995p3519995.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org