gpt4 book ai didi

javascript - Primefaces Schedule 未将 columnFormat 传递到 fullcalendar 右侧

转载 作者:行者123 更新时间:2023-12-03 04:22:44 27 4
gpt4 key购买 nike

使用PF 6.1,js 2.2运行在tomcat7上

我有一个<p:schedule>组件设置如下:

                                <p:schedule
id="mySchedule"
value="#{myBean.agenda}"
widgetVar="myschedule"
scrollTime="08:00:00"
showWeekends="false"
timeZone="#{serverBean.timeZone}"
minTime="07:00:00"
maxTime="21:00:00"
timeFormat="HH:mm"
axisFormat="HH:mm"
slotDuration="00:15:00"
draggable="false"
resizable="false"
view="agendaWeek"
columnFormat="'dddd'"
allDaySlot="false">

</p:schedule>

当页面渲染时,JS 引擎抛出此错误:

Syntax error: missing : after property id
at: "HH:mm",timeFormat:"HH:mm",columnFormatOptions:{'dddd'}});});

选项“dddd”对 FullCalendar 有效:

'dddd' // like 'Monday', ref
A single string alone will set the value for all views.

  • columnFormat="'dddd'" 上的单引号不相关。删除它们只会在浏览器控制台上产生另一个错误:

    ReferenceError: dddd is not defined

我应该如何设置columnFormat在 XHTML 上,以便它可以直接到达 FullCalendar?

最佳答案

PrimeFaces columnFormat 不要求您编写完整的 json,以防您需要每个 View 的标题,因此

  columnFormat="month: 'dddd', week: 'dddd'"

就足够了,而不是

  columnFormat="{month: 'dddd', week: 'dddd'}"

PrimeFaces 会自动在您输入的值周围添加 {},如 source of the ScheduleRenderer.java 中所示。 。所以只需在其中输入一个字符串,例如

  columnFormat="'dddd'"

结果

  columnFormatOptions:{'dddd'}

这是无效的 json,这就是您收到的错误...“dddd”被视为键,并且后面没有 : 分隔符,后面应该有一个值。

如果您将相同的字符串放入普通的 jquery fullcalendar 中,您会得到相同的错误。

我看到的唯一选择是使用扩展器功能,或声明每个 View 。

关于javascript - Primefaces Schedule 未将 columnFormat 传递到 fullcalendar 右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43872469/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com