You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kurt Heston <kh...@hestonsystems.com> on 2010/08/30 19:51:22 UTC

floating div?

I have a really long table with qty values in one of the columns.  
Instead of having a total at the bottom of the page (and requiring the 
user to scroll to see it), I'd like to float a div in the bottom right 
that I can update on the fly as the user changes qty values.

The wicketstuff dojo package had a way to do it, but I don't believe 
it's compatible with 1.4.  Any ideas?

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


Re: floating div?

Posted by Kurt Heston <kh...@hestonsystems.com>.
I was over-engineering this.  The answer was in wicket-ajax-debug.js:

style="position:fixed; right: 100px; bottom: 100px;...

No ajax required.

On 08/30/2010 05:34 PM, Kurt Heston wrote:
> The following seems to work until the page refreshes and scrolls to 
> the top:
>
> //-------------------------------------------------------------------------------- 
>
>     Label lbl = new Label("floatDiv", "floaty text") {
>       @Override
>       protected void onComponentTag(ComponentTag tag) {
>         tag.put("style", "position: absolute; left: 610px; top: "
>             + (80 + scrollValue)
>             + "px; height: 400px; width: 100px; padding: 1em;");
>       }
>
>     };
>
>     AbstractAjaxBehavior beh = new AbstractAjaxBehavior() {
>       @Override
>       public void onRequest() {
>         scrollValue = 
> Integer.parseInt(getRequest().getParameter("scrollPos"));
>       }
>     };
>     lbl.add(beh);
>     add(lbl);
>
>     WebMarkupContainer body = new WebMarkupContainer("theBody") {
>
>       @Override
>       public boolean isTransparentResolver() {
>         return true;
>       }
>     };
>     body.add(new SimpleAttributeModifier("onscroll",
>         "var wcall=wicketAjaxPost('" + beh.getCallbackUrl(true)
>             + "&scrollPos='+window.pageYOffset)"));
>     add(body);
> //-------------------------------------------------------------------------------- 
>
>
> Not sure yet how to keep the page from scrolling to the top each time 
> the callback is made.  Still at it.  Suggestions?
>
> On 08/30/2010 10:51 AM, Kurt Heston wrote:
>> I have a really long table with qty values in one of the columns.  
>> Instead of having a total at the bottom of the page (and requiring 
>> the user to scroll to see it), I'd like to float a div in the bottom 
>> right that I can update on the fly as the user changes qty values.
>>
>> The wicketstuff dojo package had a way to do it, but I don't believe 
>> it's compatible with 1.4.  Any ideas?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org


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


Re: floating div?

Posted by Kurt Heston <kh...@hestonsystems.com>.
The following seems to work until the page refreshes and scrolls to the top:

//--------------------------------------------------------------------------------
     Label lbl = new Label("floatDiv", "floaty text") {
       @Override
       protected void onComponentTag(ComponentTag tag) {
         tag.put("style", "position: absolute; left: 610px; top: "
             + (80 + scrollValue)
             + "px; height: 400px; width: 100px; padding: 1em;");
       }

     };

     AbstractAjaxBehavior beh = new AbstractAjaxBehavior() {
       @Override
       public void onRequest() {
         scrollValue = 
Integer.parseInt(getRequest().getParameter("scrollPos"));
       }
     };
     lbl.add(beh);
     add(lbl);

     WebMarkupContainer body = new WebMarkupContainer("theBody") {

       @Override
       public boolean isTransparentResolver() {
         return true;
       }
     };
     body.add(new SimpleAttributeModifier("onscroll",
         "var wcall=wicketAjaxPost('" + beh.getCallbackUrl(true)
             + "&scrollPos='+window.pageYOffset)"));
     add(body);
//--------------------------------------------------------------------------------

Not sure yet how to keep the page from scrolling to the top each time 
the callback is made.  Still at it.  Suggestions?

On 08/30/2010 10:51 AM, Kurt Heston wrote:
> I have a really long table with qty values in one of the columns.  
> Instead of having a total at the bottom of the page (and requiring the 
> user to scroll to see it), I'd like to float a div in the bottom right 
> that I can update on the fly as the user changes qty values.
>
> The wicketstuff dojo package had a way to do it, but I don't believe 
> it's compatible with 1.4.  Any ideas?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org


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