You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marcin Zajączkowski <ms...@wp.pl> on 2012/11/12 01:58:14 UTC

Ability to simply enable jQuery.noConflict() globally for an application in Wicket 6

Hi, I have an application which internally uses prototype. After
migration from Wicket 1.5 to 6 I had problems with conflicts. It helped
to enable non conflict mode in jQuery, but to do this globally I had to
do a few things:
 - an one line script
 - a corresponding JavaScriptResourceReference
 - a new JavaScriptBundle which bundle it with the original one
 - set a jQueryReference to my bundle

Is there any simpler way to do that? There is probably more people
facing with that problem and some build in solution which be useful.

Regards
Marcin

-- 
http://blog.solidsoft.info/ - Working code is not enough


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


Re: Ability to simply enable jQuery.noConflict() globally for an application in Wicket 6

Posted by Marcin Zajączkowski <ms...@wp.pl>.
Thanks Martijn for your replies. I have just found them.

On 2012-11-13 13:23, Martijn Dashorst wrote:
> If you don't have a common base page for all your pages, then you can
> use a ComponentInstantiationListener that adds a behavior to all
> pages, rendering the specific javascript invocations.
> 
> Else, just override the renderHead(IHeaderResponse) method in your
> base page and do the javascript voodoo there.

I tried the solution with renderHead(IHeaderResponse), but both
JavaScriptHeaderItem.forScript() and OnDomReadyHeaderItem.forScript()
generates script in the wrong place (between my script and JQuery from
Wicket or after jQuery and my script which already generates JS errors).
I need something which will be inserted just after jquery from Wicket,
before my custom scripts which are also inserted on particular pages in
renderHead(). ComponentInstantiationListener probably works in the same way.
In addition adding "jQuery.noConflict();" globally for all my pages
generates full jQuery import also on pages where no Java Script is used
(probably small impact, but always).

Thereupon I think that an ability to simply switch jquery to a
non-conflict mode would be a nice feature for people having problems
similar to mine.

Marcin



> On Mon, Nov 12, 2012 at 8:44 AM, Martin Grigorov <mg...@apache.org> wrote:
>> Hi,
>>
>> For wicket-examples'
>> http://www.wicket-library.com/wicket-examples-6.0.x/ajax/effects<http://www.wicket-library.com/wicket-examples-6.0.x/ajax/effects?1>
>> all
>> I had to do was to add
>>
>> @Override
>> public void renderHead(IHeaderResponse response)
>> {
>> super.renderHead(response);
>>
>> response.render(OnDomReadyHeaderItem.forScript("jQuery.noConflict();"));
>> }
>>
>> to the page that uses Prototype (EffectsPage.java).
>>
>> But it is quite simple demo so maybe more work is needed in a real use case
>> like yours.
>>
>>
>> On Mon, Nov 12, 2012 at 2:58 AM, Marcin Zajączkowski <ms...@wp.pl> wrote:
>>
>>> Hi, I have an application which internally uses prototype. After
>>> migration from Wicket 1.5 to 6 I had problems with conflicts. It helped
>>> to enable non conflict mode in jQuery, but to do this globally I had to
>>> do a few things:
>>>  - an one line script
>>>  - a corresponding JavaScriptResourceReference
>>>  - a new JavaScriptBundle which bundle it with the original one
>>>  - set a jQueryReference to my bundle
>>>
>>> Is there any simpler way to do that? There is probably more people
>>> facing with that problem and some build in solution which be useful.
>>>
>>> Regards
>>> Marcin
>>>
>>> --
>>> http://blog.solidsoft.info/ - Working code is not enough
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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 <http://jweekend.com/>
> 
> 
> 


-- 
http://blog.solidsoft.info/ - Working code is not enough



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


Re: Ability to simply enable jQuery.noConflict() globally for an application in Wicket 6

Posted by Martijn Dashorst <ma...@gmail.com>.
If you don't have a common base page for all your pages, then you can
use a ComponentInstantiationListener that adds a behavior to all
pages, rendering the specific javascript invocations.

Else, just override the renderHead(IHeaderResponse) method in your
base page and do the javascript voodoo there.

Martijn

On Mon, Nov 12, 2012 at 8:44 AM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> For wicket-examples'
> http://www.wicket-library.com/wicket-examples-6.0.x/ajax/effects<http://www.wicket-library.com/wicket-examples-6.0.x/ajax/effects?1>
> all
> I had to do was to add
>
> @Override
> public void renderHead(IHeaderResponse response)
> {
> super.renderHead(response);
>
> response.render(OnDomReadyHeaderItem.forScript("jQuery.noConflict();"));
> }
>
> to the page that uses Prototype (EffectsPage.java).
>
> But it is quite simple demo so maybe more work is needed in a real use case
> like yours.
>
>
> On Mon, Nov 12, 2012 at 2:58 AM, Marcin Zajączkowski <ms...@wp.pl> wrote:
>
>> Hi, I have an application which internally uses prototype. After
>> migration from Wicket 1.5 to 6 I had problems with conflicts. It helped
>> to enable non conflict mode in jQuery, but to do this globally I had to
>> do a few things:
>>  - an one line script
>>  - a corresponding JavaScriptResourceReference
>>  - a new JavaScriptBundle which bundle it with the original one
>>  - set a jQueryReference to my bundle
>>
>> Is there any simpler way to do that? There is probably more people
>> facing with that problem and some build in solution which be useful.
>>
>> Regards
>> Marcin
>>
>> --
>> http://blog.solidsoft.info/ - Working code is not enough
>>
>>
>> ---------------------------------------------------------------------
>> 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 <http://jweekend.com/>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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


Re: Ability to simply enable jQuery.noConflict() globally for an application in Wicket 6

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

For wicket-examples'
http://www.wicket-library.com/wicket-examples-6.0.x/ajax/effects<http://www.wicket-library.com/wicket-examples-6.0.x/ajax/effects?1>
all
I had to do was to add

@Override
public void renderHead(IHeaderResponse response)
{
super.renderHead(response);

response.render(OnDomReadyHeaderItem.forScript("jQuery.noConflict();"));
}

to the page that uses Prototype (EffectsPage.java).

But it is quite simple demo so maybe more work is needed in a real use case
like yours.


On Mon, Nov 12, 2012 at 2:58 AM, Marcin Zajączkowski <ms...@wp.pl> wrote:

> Hi, I have an application which internally uses prototype. After
> migration from Wicket 1.5 to 6 I had problems with conflicts. It helped
> to enable non conflict mode in jQuery, but to do this globally I had to
> do a few things:
>  - an one line script
>  - a corresponding JavaScriptResourceReference
>  - a new JavaScriptBundle which bundle it with the original one
>  - set a jQueryReference to my bundle
>
> Is there any simpler way to do that? There is probably more people
> facing with that problem and some build in solution which be useful.
>
> Regards
> Marcin
>
> --
> http://blog.solidsoft.info/ - Working code is not enough
>
>
> ---------------------------------------------------------------------
> 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 <http://jweekend.com/>