jquery - XPages fullCalendar is not a function -
hello need use fullcalendar scheduler example scheduler code (if open source code of example page simple undestard)
so in xpages have created xpages code :
<?xml version="1.0" encoding="utf-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core"> <xp:div styleclass="calendarcss " id="calendar"> </xp:div> <xp:scriptblock id="scriptblock1"> <xp:this.value><![cdata[$(function() { // document ready var x=x$("#{id:calendar}"); x.fullcalendar({ defaultview: 'agendaday', defaultdate: '2016-01-07', editable: true, selectable: true, eventlimit: true, // allow "more" link when many events header: { left: 'prev,next today', center: 'title', right: 'agendaday,agendatwoday,agendaweek,month' }, views: { agendatwoday: { type: 'agenda', duration: { days: 2 }, // views more day not behavior default // so, need explicitly enable groupbyresource: true //// uncomment line group day first resources underneath //groupbydateandresource: true } }, //// uncomment line hide all-day slot //alldayslot: false, resources: [ { id: 'a', title: 'room a' }, { id: 'b', title: 'room b', eventcolor: 'green' }, { id: 'c', title: 'room c', eventcolor: 'orange' }, { id: 'd', title: 'room d', eventcolor: 'red' } ], events: [ { id: '1', resourceid: 'a', start: '2016-01-06', end: '2016-01-08', title: 'event 1' }, { id: '2', resourceid: 'a', start: '2016-01-07t09:00:00', end: '2016-01-07t14:00:00', title: 'event 2' }, { id: '3', resourceid: 'b', start: '2016-01-07t12:00:00', end: '2016-01-08t06:00:00', title: 'event 3' }, { id: '4', resourceid: 'c', start: '2016-01-07t07:30:00', end: '2016-01-07t09:30:00', title: 'event 4' }, { id: '5', resourceid: 'd', start: '2016-01-07t10:00:00', end: '2016-01-07t15:00:00', title: 'event 5' } ], select: function(start, end, jsevent, view, resource) { console.log( 'select', start.format(), end.format(), resource ? resource.id : '(no resource)' ); }, dayclick: function(date, jsevent, view, resource) { console.log( 'dayclick', date.format(), resource ? resource.id : '(no resource)' ); } }); });]]></xp:this.value> </xp:scriptblock> </xp:view>
all work corretly if disable dojo xsp.client.script.libraries=none
if remove above line firebug console show me error in 3 lines of scriptblock:
fullcalendar not function
some idea fix , enable corretly dojo library?
ok problem amd loader ... solution insert code before dojo...with statement
<xp:this.properties> <xp:parameter name="xsp.resources.aggregate" value="true" /> </xp:this.properties> <xp:this.resources> <xp:headtag tagname="script"> <xp:this.attributes> <xp:parameter name="type" value="text/javascript" /> <xp:parameter name="src" value="jquery-2.1.4.min.js" /> </xp:this.attributes> </xp:headtag> <xp:headtag tagname="script"> <xp:this.attributes> <xp:parameter name="type" value="text/javascript" /> <xp:parameter name="src" value="moment.min.js" /> </xp:this.attributes> </xp:headtag> <xp:headtag tagname="script"> <xp:this.attributes> <xp:parameter name="type" value="text/javascript" /> <xp:parameter name="src" value="fullcalendar.min.js" /> </xp:this.attributes> </xp:headtag> <xp:headtag tagname="script"> <xp:this.attributes> <xp:parameter name="type" value="text/javascript" /> <xp:parameter name="src" value="scheduler.min.js" /> </xp:this.attributes> </xp:headtag> </xp:this.resources>
Comments
Post a Comment