You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "marioosh.net" <ma...@gmail.com> on 2010/03/17 10:05:48 UTC

Simple javascript from wicket

I have container and buttons element in my template:

	<div wicket:id="container">
		<span>
			...
		</span>
		<span wicket:id="buttons" style="display: none;">
			<a href="#" wicket:id="edit">E</a>
			<a href="#" wicket:id="delete">D</a>
		</span>
	</div>

and java:
		container.add(new AjaxEventBehavior("onmouseover") {
			protected void onEvent(AjaxRequestTarget target) {
				buttons.add(new SimpleAttributeModifier("style", "display: ;"));
				target.addComponent(buttons);
			}
		});

On mouseover container i show buttons, but i think it sends request to
server in that way.
Is possible to change style in js only (but programming in wicket),
not sending request to server ?
How in wicket do some js work, but not interacting with server ?

-- 
Greetings,
marioosh

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


Re: Simple javascript from wicket

Posted by "marioosh.net" <ma...@gmail.com>.
2010/3/18 Jeremy Thomerson <je...@wickettraining.com>:
> Wicket is "just java, just html".  Just add the JS to your HTML file.  Don't
> add an AjaxEventBehavior in java - because you don't want Ajax, and you
> don't need to do it in the java.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>

Thanks...
I did that in that way:

		WebMarkupContainer container = new WebMarkupContainer("container"){
			@Override
			protected void onComponentTag(ComponentTag tag) {
				super.onComponentTag(tag);
				
				// prototype'owo hide and show
				tag.put("onmouseover", "$('"+ buttons.getMarkupId() +"').show()");
				tag.put("onmouseout", "$('"+ buttons.getMarkupId() +"').hide()");
			}			
		};

-- 
Greetings,
marioosh

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


Re: Simple javascript from wicket

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Wicket is "just java, just html".  Just add the JS to your HTML file.  Don't
add an AjaxEventBehavior in java - because you don't want Ajax, and you
don't need to do it in the java.

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Mar 17, 2010 at 4:05 AM, marioosh.net <ma...@gmail.com>wrote:

> I have container and buttons element in my template:
>
>        <div wicket:id="container">
>                <span>
>                        ...
>                </span>
>                <span wicket:id="buttons" style="display: none;">
>                        <a href="#" wicket:id="edit">E</a>
>                        <a href="#" wicket:id="delete">D</a>
>                </span>
>        </div>
>
> and java:
>                container.add(new AjaxEventBehavior("onmouseover") {
>                        protected void onEvent(AjaxRequestTarget target) {
>                                buttons.add(new
> SimpleAttributeModifier("style", "display: ;"));
>                                target.addComponent(buttons);
>                        }
>                });
>
> On mouseover container i show buttons, but i think it sends request to
> server in that way.
> Is possible to change style in js only (but programming in wicket),
> not sending request to server ?
> How in wicket do some js work, but not interacting with server ?
>
> --
> Greetings,
> marioosh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>