You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lurtz Nazgul <lu...@ymail.com> on 2011/07/14 12:27:10 UTC
Generate ajax link
Hi all;
I can generate normal links in to my dynamic menu
<li><a href='?thePanel=com.test.PanelOne'></a></li>
...
I wonder if i can generate those links in ajax link format ?
Thanks.
Re: Generate ajax link
Posted by Martin Grigorov <mg...@apache.org>.
This JavaScript is generated by AbstractDefaultAjaxBehavior.
On Thu, Jul 14, 2011 at 11:26 PM, Lurtz Nazgul <lu...@ymail.com> wrote:
> Thanks Martin; but it doesn't make sense to me, sorry.
>
> Wicket generates below code for a simple counter increment example.
>
> var wcall =
> wicketAjaxGet('?wicket:interface=:2:panel1:okla::IBehaviorListener:0:',
The first parameter is the callback url to the ajax behavior.
This means: find the first behavior in component with id 'okla' which
is in component with id 'panel1' which is in page with id 2.
> function() {
> }.bind(this),
The first function is the onSuccess callback
function() {
> }.bind(this),
The second is the onFailure callback
function() {
> return Wicket.$('okla') != null;
> }.bind(this));
The last is the precondition: execute the Ajax request only if there
is an HTMLElement with id 'okla' in the DOM.
> return !wcall;
Just the callback url is mandatory parameter, all other can be null.
>
> Any suggestions ?
>
> Thanks.
>
>
>
> ________________________________
> From: Martin Grigorov <mg...@apache.org>
> To: users@wicket.apache.org
> Sent: Thu, July 14, 2011 2:46:04 PM
> Subject: Re: Generate ajax link
>
> See how AjaxLink generates its markup.
>
> On Thu, Jul 14, 2011 at 2:31 PM, Lurtz Nazgul <lu...@ymail.com> wrote:
>> I mean; generating ajax link format
>>
>> Instead of
>>
>> <li><a href='?thePanel=com.test.PanelOne'></a></li>
>>
>> I want to generate ajax link on the fly
>>
>> Example :
>> <a onclick="var
>> wcall=wicketAjaxGet('wicket/page?2-1.IBehaviorListener.0-c1--link',function()
> {
>> }.bind(this),function() { }.bind(this), function() {return Wicket.$('idc') !=
>> null;}.bind(this));return !wcall;" id="idc" href="#">increment</a>
>>
>> Any suggestions ?
>>
>> Thanks.
>>
>>
>>
>>
>> ________________________________
>> From: Andrea Del Bene <ad...@ciseonweb.it>
>> To: users@wicket.apache.org
>> Sent: Thu, July 14, 2011 2:00:32 PM
>> Subject: Re: Generate ajax link
>>
>> Hi,
>>
>> you can use Loop component to generate a dynamic number of links. For example:
>>
>>
>>
>> HTML code:
>>
>> <ol title="Menù" class="main_menu">
>> <li style="list-style: none;" wicket:id="itemList">
>> <a wicket:id="menuItem"></a>
>> </li>
>> </ol>
>>
>>
>>
>> Java code:
>>
>>
>> List<AbstractLink> linkList = ...
>> Loop loop = new Loop("itemList", linkList.size()) {
>> @Override
>> protected void populateItem(LoopItem item) {
>> AbstractLink curLink = linkList.get(item.getIndex());
>> item.add(curLink);
>> }
>> };
>>
>>
>>
>>> Hi all;
>>>
>>> I can generate normal links in to my dynamic menu
>>>
>>> <li><a href='?thePanel=com.test.PanelOne'></a></li>
>>> ...
>>>
>>> I wonder if i can generate those links in ajax link format ?
>>>
>>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Generate ajax link
Posted by Lurtz Nazgul <lu...@ymail.com>.
Thanks Martin; but it doesn't make sense to me, sorry.
Wicket generates below code for a simple counter increment example.
var wcall =
wicketAjaxGet('?wicket:interface=:2:panel1:okla::IBehaviorListener:0:',
function() {
}.bind(this), function() {
}.bind(this), function() {
return Wicket.$('okla') != null;
}.bind(this));
return !wcall;
Any suggestions ?
Thanks.
________________________________
From: Martin Grigorov <mg...@apache.org>
To: users@wicket.apache.org
Sent: Thu, July 14, 2011 2:46:04 PM
Subject: Re: Generate ajax link
See how AjaxLink generates its markup.
On Thu, Jul 14, 2011 at 2:31 PM, Lurtz Nazgul <lu...@ymail.com> wrote:
> I mean; generating ajax link format
>
> Instead of
>
> <li><a href='?thePanel=com.test.PanelOne'></a></li>
>
> I want to generate ajax link on the fly
>
> Example :
> <a onclick="var
> wcall=wicketAjaxGet('wicket/page?2-1.IBehaviorListener.0-c1--link',function()
{
> }.bind(this),function() { }.bind(this), function() {return Wicket.$('idc') !=
> null;}.bind(this));return !wcall;" id="idc" href="#">increment</a>
>
> Any suggestions ?
>
> Thanks.
>
>
>
>
> ________________________________
> From: Andrea Del Bene <ad...@ciseonweb.it>
> To: users@wicket.apache.org
> Sent: Thu, July 14, 2011 2:00:32 PM
> Subject: Re: Generate ajax link
>
> Hi,
>
> you can use Loop component to generate a dynamic number of links. For example:
>
>
>
> HTML code:
>
> <ol title="Menù" class="main_menu">
> <li style="list-style: none;" wicket:id="itemList">
> <a wicket:id="menuItem"></a>
> </li>
> </ol>
>
>
>
> Java code:
>
>
> List<AbstractLink> linkList = ...
> Loop loop = new Loop("itemList", linkList.size()) {
> @Override
> protected void populateItem(LoopItem item) {
> AbstractLink curLink = linkList.get(item.getIndex());
> item.add(curLink);
> }
> };
>
>
>
>> Hi all;
>>
>> I can generate normal links in to my dynamic menu
>>
>> <li><a href='?thePanel=com.test.PanelOne'></a></li>
>> ...
>>
>> I wonder if i can generate those links in ajax link format ?
>>
>> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Generate ajax link
Posted by Martin Grigorov <mg...@apache.org>.
See how AjaxLink generates its markup.
On Thu, Jul 14, 2011 at 2:31 PM, Lurtz Nazgul <lu...@ymail.com> wrote:
> I mean; generating ajax link format
>
> Instead of
>
> <li><a href='?thePanel=com.test.PanelOne'></a></li>
>
> I want to generate ajax link on the fly
>
> Example :
> <a onclick="var
> wcall=wicketAjaxGet('wicket/page?2-1.IBehaviorListener.0-c1--link',function() {
> }.bind(this),function() { }.bind(this), function() {return Wicket.$('idc') !=
> null;}.bind(this));return !wcall;" id="idc" href="#">increment</a>
>
> Any suggestions ?
>
> Thanks.
>
>
>
>
> ________________________________
> From: Andrea Del Bene <ad...@ciseonweb.it>
> To: users@wicket.apache.org
> Sent: Thu, July 14, 2011 2:00:32 PM
> Subject: Re: Generate ajax link
>
> Hi,
>
> you can use Loop component to generate a dynamic number of links. For example:
>
>
>
> HTML code:
>
> <ol title="Menù" class="main_menu">
> <li style="list-style: none;" wicket:id="itemList">
> <a wicket:id="menuItem"></a>
> </li>
> </ol>
>
>
>
> Java code:
>
>
> List<AbstractLink> linkList = ...
> Loop loop = new Loop("itemList", linkList.size()) {
> @Override
> protected void populateItem(LoopItem item) {
> AbstractLink curLink = linkList.get(item.getIndex());
> item.add(curLink);
> }
> };
>
>
>
>> Hi all;
>>
>> I can generate normal links in to my dynamic menu
>>
>> <li><a href='?thePanel=com.test.PanelOne'></a></li>
>> ...
>>
>> I wonder if i can generate those links in ajax link format ?
>>
>> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Generate ajax link
Posted by Lurtz Nazgul <lu...@ymail.com>.
I mean; generating ajax link format
Instead of
<li><a href='?thePanel=com.test.PanelOne'></a></li>
I want to generate ajax link on the fly
Example :
<a onclick="var
wcall=wicketAjaxGet('wicket/page?2-1.IBehaviorListener.0-c1--link',function() {
}.bind(this),function() { }.bind(this), function() {return Wicket.$('idc') !=
null;}.bind(this));return !wcall;" id="idc" href="#">increment</a>
Any suggestions ?
Thanks.
________________________________
From: Andrea Del Bene <ad...@ciseonweb.it>
To: users@wicket.apache.org
Sent: Thu, July 14, 2011 2:00:32 PM
Subject: Re: Generate ajax link
Hi,
you can use Loop component to generate a dynamic number of links. For example:
HTML code:
<ol title="Menù" class="main_menu">
<li style="list-style: none;" wicket:id="itemList">
<a wicket:id="menuItem"></a>
</li>
</ol>
Java code:
List<AbstractLink> linkList = ...
Loop loop = new Loop("itemList", linkList.size()) {
@Override
protected void populateItem(LoopItem item) {
AbstractLink curLink = linkList.get(item.getIndex());
item.add(curLink);
}
};
> Hi all;
>
> I can generate normal links in to my dynamic menu
>
> <li><a href='?thePanel=com.test.PanelOne'></a></li>
> ...
>
> I wonder if i can generate those links in ajax link format ?
>
> Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Generate ajax link
Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi,
you can use Loop component to generate a dynamic number of links. For
example:
HTML code:
<ol title="Menù" class="main_menu">
<li style="list-style: none;" wicket:id="itemList">
<a wicket:id="menuItem"></a>
</li>
</ol>
Java code:
List<AbstractLink> linkList = ...
Loop loop = new Loop("itemList", linkList.size()) {
@Override
protected void populateItem(LoopItem item) {
AbstractLink curLink = linkList.get(item.getIndex());
item.add(curLink);
}
};
> Hi all;
>
> I can generate normal links in to my dynamic menu
>
> <li><a href='?thePanel=com.test.PanelOne'></a></li>
> ...
>
> I wonder if i can generate those links in ajax link format ?
>
> Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org