Re: adding component Dynamically

2015-03-09 Thread avchavan
I've checked browser console and the onclick call never gets triggered when i
click on the more link. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-component-Dynamically-tp4669838p4669892.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: adding component Dynamically

2015-03-04 Thread Sven Meier

Hi,

could you be more specific on how it doesn't work?
Check your browser's network console whether the request is sent 
actually. Then put a breakpoint in 
ListenerInterfaceRequestHandler#respond() and check what happens on the 
server.


BTW you should use new AjaxEventBehavior(click) instead.

Have fun
Sven

Am 04.03.2015 um 14:41 schrieb avchavan:

Hi,
I want to add a link to my html dynamically via wicket.
I have written code for that which works as far as displaying the link is
concerned.
But the onclick of the link doesnt work.

final WebMarkupContainer more = new WebMarkupContainer(more);

final String toelichtingText = 
item.getModelObject().getToelichting();

String less;
if(item.getModelObject().getToelichting().length()  20  
javaScript){
if(toelichtingText.indexOf( , 20) != -1){
less = toelichtingText.substring(0, 
toelichtingText.indexOf( , 20))+
...more ;
}else{
less = toelichtingText;
more.setVisible(false);
}
}else{
less = toelichtingText;
more.setVisible(false);
}
final ModelString strMdl = Model.of(less);
final WebMarkupContainer toelichtingContainer = new
WebMarkupContainer(toelichtingContainer);
final Label lessToelichting = new Label(toelichting, strMdl);
lessToelichting.setOutputMarkupPlaceholderTag(true);
lessToelichting.setEscapeModelStrings(false);
more.add(new AjaxEventBehavior(onclick) {
@Override
protected void onEvent(AjaxRequestTarget target) {
strMdl.setObject(toelichtingText);
more.setVisible(false);
target.add(lessToelichting);
target.add(more);
}

@Override
protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);

attributes.setEventPropagation(EventPropagation.STOP);
}
});

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-component-Dynamically-tp4669838.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



adding component Dynamically

2015-03-04 Thread avchavan
Hi,
I want to add a link to my html dynamically via wicket.
I have written code for that which works as far as displaying the link is
concerned.
But the onclick of the link doesnt work.

final WebMarkupContainer more = new WebMarkupContainer(more);

final String toelichtingText = 
item.getModelObject().getToelichting();

String less;
if(item.getModelObject().getToelichting().length()  20  
javaScript){
if(toelichtingText.indexOf( , 20) != -1){
less = toelichtingText.substring(0, 
toelichtingText.indexOf( , 20))+
...more ;
}else{
less = toelichtingText;
more.setVisible(false);
}
}else{
less = toelichtingText;
more.setVisible(false);
}
final ModelString strMdl = Model.of(less);
final WebMarkupContainer toelichtingContainer = new
WebMarkupContainer(toelichtingContainer);
final Label lessToelichting = new Label(toelichting, strMdl);
lessToelichting.setOutputMarkupPlaceholderTag(true);
lessToelichting.setEscapeModelStrings(false);
more.add(new AjaxEventBehavior(onclick) {
@Override
protected void onEvent(AjaxRequestTarget target) {
strMdl.setObject(toelichtingText);
more.setVisible(false);
target.add(lessToelichting);
target.add(more);
}

@Override
protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);

attributes.setEventPropagation(EventPropagation.STOP);
}
});

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-component-Dynamically-tp4669838.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