Re: IE call wicket twice from JS

2011-05-14 Thread vov
Thanks for you reply.

Unfortunately jQuery did't help.

My new code:
String script = $('#corruptedPackagesDiv').scroll(function(){ //
+ var var1 = $('#corruptedPackagesDiv').scrollTop(); //
+ var var2 = $('#corruptedPackagesDiv').height(); //
+ var var3 = $('# + table.getMarkupId() + ').outerHeight();
//
+ if((var1 + var2) == var3){ //
+ generateCallbackScript(wicketAjaxGet(' + getCallbackUrl() +
') //
+ }});;
and in HTML:
wicket:head


/wicket:head

but nothing changed for IE.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/IE-call-wicket-twice-from-JS-tp3519995p3521911.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



Re: IE call wicket twice from JS

2011-05-14 Thread Igor Vaynberg
i would google around for other people trying to do this with JS,
doesnt seem like a wicket problem.

-igor


On Sat, May 14, 2011 at 12:51 AM, vov vov...@mail.ru wrote:
 Thanks for you reply.

 Unfortunately jQuery did't help.

 My new code:
 String script = $('#corruptedPackagesDiv').scroll(function(){ //
            + var var1 = $('#corruptedPackagesDiv').scrollTop(); //
            + var var2 = $('#corruptedPackagesDiv').height(); //
            + var var3 = $('# + table.getMarkupId() + ').outerHeight();
 //
            + if((var1 + var2) == var3){ //
            + generateCallbackScript(wicketAjaxGet(' + getCallbackUrl() +
 ') //
            + }});;
 and in HTML:
 wicket:head


 /wicket:head

 but nothing changed for IE.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/IE-call-wicket-twice-from-JS-tp3519995p3521911.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



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



IE call wicket twice from JS

2011-05-13 Thread vov
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 DataTableContact table = new DataTableContact(table, //
(IColumnContact[]) Arrays.asList(new
PropertyColumnContact(Model.of(Name), name)).toArray(), //
new ListDataProviderContact(generateContacts()),
Integer.MAX_VALUE);
add(table.setOutputMarkupId(true));
final Label label = new Label(label, new ModelInteger()
{
  @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 ListContact generateContacts()
  {
ListContact contacts = new ArrayListContact();
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



Re: IE call wicket twice from JS

2011-05-13 Thread Igor Vaynberg
it may be a problem with IE sending events differently. i would try to
use jquery in hopes that it normalizes how events work across
browsers.

-igor

On Fri, May 13, 2011 at 4:34 AM, vov vov...@mail.ru wrote:
 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 DataTableContact table = new DataTableContact(table, //
        (IColumnContact[]) Arrays.asList(new
 PropertyColumnContact(Model.of(Name), name)).toArray(), //
        new ListDataProviderContact(generateContacts()),
 Integer.MAX_VALUE);
    add(table.setOutputMarkupId(true));
    final Label label = new Label(label, new ModelInteger()
    {
      @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 ListContact generateContacts()
  {
    ListContact contacts = new ArrayListContact();
    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



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org