You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Serkan Camurcuoglu <se...@telenity.com> on 2008/06/12 14:40:46 UTC

Wicket Datepicker javascript not loaded in portlet environment

Hi all,
I'm trying to use an 
org.apache.wicket.datetime.markup.html.form.DateTextField component 
which contains a org.apache.wicket.extensions.yui.calendar.DatePicker in 
my portlet application. The field is contained in a panel with the 
markup like:

<wicket:panel>
    <input type="text" wicket:id="dateInput"/>
</wicket:panel>

and the panel is contained in a listview, which is also contained within 
a form. When I access the application directly, the date picker works 
fine. But when I access it as a portlet, the date picker is displayed 
correctly but it does not show the calendar when I click the icon. When 
I check with the javascript debugger, I see that wicket-event.js and 
yuiloader-beta.js files are loaded, but calendar.js and wicket-date.js 
are not loaded. I've included a related excerpt from the generated html 
page below. As far as I understand, these javascript files are 
dynamically included by YUI loader. But in a portlet environment they 
are not loaded, and I cannot use the venkman javascript debugger since 
this happens during page load. I'm using Wicket 1.3.3 and Firefox 2.0. 
Does anybody have any idea why these js files are not loaded? It would 
be great if anybody would tell me what could be wrong and give me some 
pointers on debugging this javascript code.

Best regards,

SerkanC


<script type="text/javascript" src="/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.extensions.yui.YuiLib/yuiloader-beta.js"></script>
<script type="text/javascript" src="/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script>
<script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
Wicket.Event.add(window, "domready", function() { /*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
if (typeof wicketCalendarInits == 'undefined') {
	wicketCalendarInits = new Array();
	wicketCalendarInitFinished = false;
}

initdateInputjs__681____8 = function() {
	Wicket.DateTime.init( {
		widgetId: "dateInputjs__681____8",
		componentId: "dateInputjs__681____8",				
		calendarInit: { WEEKDAYS_MEDIUM:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],WEEKDAYS_1CHAR:["S","M","T","W","T","F","S"],MONTHS_LONG:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKDAYS_LONG:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],MONTHS_SHORT:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],START_WEEKDAY:0,close:true,WEEKDAYS_SHORT:["Su","Mo","Tu","We","Th","Fr","Sa"] },
		datePattern: "M/d/yy",
		alignWithIcon: true,
		fireChangeEvent: true,
		hideOnSelect: true
	});
	
};

if (wicketCalendarInitFinished) {
	// when a DatePicker is added via ajax, the loader is already finished, so
	// we call the init function directly.
	initdateInputjs__681____8();
} else {
	// when page is rendered, all calendar components will be initialized after
	// the required js libraries have been loaded.
	wicketCalendarInits.push(initdateInputjs__681____8);
}

if (typeof wicketYuiLoader == 'undefined')	{
	wicketYuiLoader = new YAHOO.util.YUILoader({
		base: "/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.extensions.yui.YuiLib/", 
		filter: "RAW",
		allowRollup: false,
		require: ["wicket-date"],		
		onSuccess: function() {
			wicketCalendarInitFinished = true;	
			while (wicketCalendarInits.length > 0) {
				wicketCalendarInits.pop()();
			}		
		}
	});
	
	wicketYuiLoader.addModule({
		name: "wicket-date",
		type: "js",
		requires: ["calendar"],
		fullpath: "/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.extensions.yui.calendar.DatePicker/wicket-date.js"		           
	});
	wicketYuiLoader.insert();
}

;});


/*-->]]>*/</script>


in the

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


Re: Wicket Datepicker javascript not loaded in portlet environment

Posted by prasana <pr...@bluenog.com>.
Hi Serkan,

Did you fix this issue.

I am also facing the same issue in portlet environment when using firefox
2.0

I really appreciate, if you give some pointers on how to fix this if you
already fixed this issue.

Thanks
Prasanna


Serkan Camurcuoglu-2 wrote:
> 
> Hi all,
> I'm trying to use an 
> org.apache.wicket.datetime.markup.html.form.DateTextField component 
> which contains a org.apache.wicket.extensions.yui.calendar.DatePicker in 
> my portlet application. The field is contained in a panel with the 
> markup like:
> 
> <wicket:panel>
>     <input type="text" wicket:id="dateInput"/>
> </wicket:panel>
> 
> and the panel is contained in a listview, which is also contained within 
> a form. When I access the application directly, the date picker works 
> fine. But when I access it as a portlet, the date picker is displayed 
> correctly but it does not show the calendar when I click the icon. When 
> I check with the javascript debugger, I see that wicket-event.js and 
> yuiloader-beta.js files are loaded, but calendar.js and wicket-date.js 
> are not loaded. I've included a related excerpt from the generated html 
> page below. As far as I understand, these javascript files are 
> dynamically included by YUI loader. But in a portlet environment they 
> are not loaded, and I cannot use the venkman javascript debugger since 
> this happens during page load. I'm using Wicket 1.3.3 and Firefox 2.0. 
> Does anybody have any idea why these js files are not loaded? It would 
> be great if anybody would tell me what could be wrong and give me some 
> pointers on debugging this javascript code.
> 
> Best regards,
> 
> SerkanC
> 
> 
> <script type="text/javascript"
> src="/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.extensions.yui.YuiLib/yuiloader-beta.js"></script>
> <script type="text/javascript"
> src="/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script>
> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
> Wicket.Event.add(window, "domready", function() { /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> if (typeof wicketCalendarInits == 'undefined') {
> 	wicketCalendarInits = new Array();
> 	wicketCalendarInitFinished = false;
> }
> 
> initdateInputjs__681____8 = function() {
> 	Wicket.DateTime.init( {
> 		widgetId: "dateInputjs__681____8",
> 		componentId: "dateInputjs__681____8",				
> 		calendarInit: {
> WEEKDAYS_MEDIUM:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],WEEKDAYS_1CHAR:["S","M","T","W","T","F","S"],MONTHS_LONG:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKDAYS_LONG:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],MONTHS_SHORT:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],START_WEEKDAY:0,close:true,WEEKDAYS_SHORT:["Su","Mo","Tu","We","Th","Fr","Sa"]
> },
> 		datePattern: "M/d/yy",
> 		alignWithIcon: true,
> 		fireChangeEvent: true,
> 		hideOnSelect: true
> 	});
> 	
> };
> 
> if (wicketCalendarInitFinished) {
> 	// when a DatePicker is added via ajax, the loader is already finished,
> so
> 	// we call the init function directly.
> 	initdateInputjs__681____8();
> } else {
> 	// when page is rendered, all calendar components will be initialized
> after
> 	// the required js libraries have been loaded.
> 	wicketCalendarInits.push(initdateInputjs__681____8);
> }
> 
> if (typeof wicketYuiLoader == 'undefined')	{
> 	wicketYuiLoader = new YAHOO.util.YUILoader({
> 		base:
> "/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.extensions.yui.YuiLib/", 
> 		filter: "RAW",
> 		allowRollup: false,
> 		require: ["wicket-date"],		
> 		onSuccess: function() {
> 			wicketCalendarInitFinished = true;	
> 			while (wicketCalendarInits.length > 0) {
> 				wicketCalendarInits.pop()();
> 			}		
> 		}
> 	});
> 	
> 	wicketYuiLoader.addModule({
> 		name: "wicket-date",
> 		type: "js",
> 		requires: ["calendar"],
> 		fullpath:
> "/subscriber-web/buyOffer/ps:681/resources/org.apache.wicket.extensions.yui.calendar.DatePicker/wicket-date.js"		           
> 	});
> 	wicketYuiLoader.insert();
> }
> 
> ;});
> 
> 
> /*-->]]>*/</script>
> 
> 
> in the
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Wicket-Datepicker-javascript-not-loaded-in-portlet-environment-tp17799015p18746030.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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