admin管理员组文章数量:1430551
I have following xhtml file vith rich:calendar
and I'm trying to disable some days using this example. But javascript function is never called. I don't know why.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".dtd">
<html ... >
<f:view locale="en">
<script type="text/javascript">
function isDayEnabled(day){
var date = new Date(day.date);
return (date.getDay() == 6);
}
function getDisabledStyle(day){
if (!isDayEnabled(day)) return 'rich-calendar-boundary-dates disabledDay';
}
</script>
<h:head>
<style type="text/css">
.disabledDay { background-color:gray; }
</style>
</h:head>
<h:body>
<div id="workspace">
<h:form id="form">
<h:outputText value="Datum: " />
<rich:calendar mode="ajax" id="calendar"
isDayEnabled="isDayEnabled();" dayStyleClass="getDisabledStyle();">
</rich:calendar>
....
Could you help me?
I have following xhtml file vith rich:calendar
and I'm trying to disable some days using this example. But javascript function is never called. I don't know why.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html ... >
<f:view locale="en">
<script type="text/javascript">
function isDayEnabled(day){
var date = new Date(day.date);
return (date.getDay() == 6);
}
function getDisabledStyle(day){
if (!isDayEnabled(day)) return 'rich-calendar-boundary-dates disabledDay';
}
</script>
<h:head>
<style type="text/css">
.disabledDay { background-color:gray; }
</style>
</h:head>
<h:body>
<div id="workspace">
<h:form id="form">
<h:outputText value="Datum: " />
<rich:calendar mode="ajax" id="calendar"
isDayEnabled="isDayEnabled();" dayStyleClass="getDisabledStyle();">
</rich:calendar>
....
Could you help me?
Share Improve this question edited Jun 18, 2011 at 7:47 gaffcz asked Jun 17, 2011 at 20:57 gaffczgaffcz 3,47914 gold badges70 silver badges110 bronze badges1 Answer
Reset to default 5As the showcase example shows, you need to specify the sole function name. Remove the parentheses.
<rich:calendar mode="ajax" id="calendar"
isDayEnabled="isDayEnabled" dayStyleClass="getDisabledStyle">
Or when you're actually using RichFaces 4.0, then you need to check a different showcase site.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:position xmlns="http://www.w3/1999/xhtml"
xmlns:h="http://java.sun./jsf/html"
xmlns:f="http://java.sun./jsf/core"
xmlns:ui="http://java.sun./jsf/facelets"
xmlns:a4j="http://richfaces/a4j"
xmlns:rich="http://richfaces/rich">
<h:outputStylesheet>
.everyThirdDay {
background-color: gray;
}
.weekendBold {
font-weight: bold;
font-style: italic;
}
</h:outputStylesheet>
<h:outputScript>
var curDt = new Date();
function disablementFunction(day){
if (day.isWeekend) return false;
if (curDt==undefined){
curDt = day.date.getDate();
}
if (curDt.getTime() - day.date.getTime() < 0) return true; else return false;
}
function disabledClassesProv(day){
if (curDt.getTime() - day.date.getTime() >= 0) return 'rf-cal-boundary-day';
var res = '';
if (day.isWeekend) res+='weekendBold ';
if (day.day%3==0) res+='everyThirdDay';
return res;
}
</h:outputScript>
<rich:calendar dayDisableFunction="disablementFunction"
dayClassFunction="disabledClassesProv" boundaryDatesMode="scroll" />
</ui:position>
The attributes are renamed to dayDisableFunction
and dayClassFunction
.
本文标签: javascriptltrichcalendargt client side disable weekendsStack Overflow
版权声明:本文标题:javascript - <rich:calendar> client side disable weekends - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745559001a2663357.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论