You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Altuğ Bilgin Altıntaş <al...@gmail.com> on 2010/09/25 13:00:04 UTC

target.addComponent

Hi all;

At top of page i have tablesorter script

<script type="text/javascript">
        $(document).ready(function() {
            $("table").tablesorter({ widgets: ['zebra'] });
            $("table.tablesorter tr").mouseover(function() {
                $(this).addClass("over");
            });
            $("table.tablesorter tr").mouseout(function() {
                $(this).removeClass("over");
            });
            $(".content").center({ vertical:false });

        });
</script>

I am using jquery tablesorter; which works great but if i do ; ex :

target.addComponent(tableContainer);  // table which uses zebra effect and
sorting
....

Then zebra style lost;

Shoud i always use   "target.appendJavascript(" $(document).ready(function()
{......");" to view tablesorter's zebra effect ?

Any suggestions ?

Thanks.

Re: target.addComponent

Posted by Altuğ Bilgin Altıntaş <al...@gmail.com>.
At modal window 's onClose method i am adding custom Jquery (tablesorter
jquery) but it gives :

Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript:
TypeError: a is undefined

Any idea ?


2010/9/25 Jeremy Thomerson <je...@wickettraining.com>

> Yes, it needs to be re-invoked after the ajax update. The while thing will
> optimally be in a behavior so that it can get the correct markup id and can
> be contributed by both regular page loads and ajax
>
> Jeremy Thomerson
> http://wickettraining.com
> -- sent from my "smart" phone, so please excuse spelling, formatting, or
> compiler errors
>
> On Sep 25, 2010 6:01 AM, "Altuğ Bilgin Altıntaş" <al...@gmail.com> wrote:
>
> Hi all;
>
> At top of page i have tablesorter script
>
> <script type="text/javascript">
>       $(document).ready(function() {
>           $("table").tablesorter({ widgets: ['zebra'] });
>           $("table.tablesorter tr").mouseover(function() {
>               $(this).addClass("over");
>           });
>           $("table.tablesorter tr").mouseout(function() {
>               $(this).removeClass("over");
>           });
>           $(".content").center({ vertical:false });
>
>       });
> </script>
>
> I am using jquery tablesorter; which works great but if i do ; ex :
>
> target.addComponent(tableContainer);  // table which uses zebra effect and
> sorting
> ....
>
> Then zebra style lost;
>
> Shoud i always use   "target.appendJavascript("
> $(document).ready(function()
> {......");" to view tablesorter's zebra effect ?
>
> Any suggestions ?
>
> Thanks.
>

Re: target.addComponent

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Yes, it needs to be re-invoked after the ajax update. The while thing will
optimally be in a behavior so that it can get the correct markup id and can
be contributed by both regular page loads and ajax

Jeremy Thomerson
http://wickettraining.com
-- sent from my "smart" phone, so please excuse spelling, formatting, or
compiler errors

On Sep 25, 2010 6:01 AM, "Altuğ Bilgin Altıntaş" <al...@gmail.com> wrote:

Hi all;

At top of page i have tablesorter script

<script type="text/javascript">
       $(document).ready(function() {
           $("table").tablesorter({ widgets: ['zebra'] });
           $("table.tablesorter tr").mouseover(function() {
               $(this).addClass("over");
           });
           $("table.tablesorter tr").mouseout(function() {
               $(this).removeClass("over");
           });
           $(".content").center({ vertical:false });

       });
</script>

I am using jquery tablesorter; which works great but if i do ; ex :

target.addComponent(tableContainer);  // table which uses zebra effect and
sorting
....

Then zebra style lost;

Shoud i always use   "target.appendJavascript(" $(document).ready(function()
{......");" to view tablesorter's zebra effect ?

Any suggestions ?

Thanks.

Re: target.addComponent

Posted by Sven Meier <sv...@meiers.net>.
Forget about jquery's $(document).ready() and always initialize 
javascript in IHeaderContributor#renderHead() via 
response#renderOnDomReadyJavascript() or #renderOnLoadJavascript():

                     @Override
                     public void renderHead(IHeaderResponse response)
                     {
                         response.renderOnLoadJavascript(getJsInit());
                     }

This way it will work on normal page loads and ajax refreshs too.

Sven


On 09/25/2010 01:00 PM, Altuğ Bilgin Altıntaş wrote:
> Hi all;
>
> At top of page i have tablesorter script
>
> <script type="text/javascript">
>          $(document).ready(function() {
>              $("table").tablesorter({ widgets: ['zebra'] });
>              $("table.tablesorter tr").mouseover(function() {
>                  $(this).addClass("over");
>              });
>              $("table.tablesorter tr").mouseout(function() {
>                  $(this).removeClass("over");
>              });
>              $(".content").center({ vertical:false });
>
>          });
> </script>
>
> I am using jquery tablesorter; which works great but if i do ; ex :
>
> target.addComponent(tableContainer);  // table which uses zebra effect and
> sorting
> ....
>
> Then zebra style lost;
>
> Shoud i always use   "target.appendJavascript(" $(document).ready(function()
> {......");" to view tablesorter's zebra effect ?
>
> Any suggestions ?
>
> Thanks.
>
>    


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