asp.net - jquery fullcalendar with colored events -
i'm new in query , have problem fullcalendar (http://arshaw.com/fullcalendar/). want color events depending on types.
js:
$(document).ready(function () { $('#fullcal').fullcalendar({ alldaydefault: false, defaultview: 'agendaweek', eventsources: [ { url: 'ws.asmx/getschedulerevents', type: 'post', data: { tasktype: 'todo' }, color: 'red', textcolor: 'black' }, { url: 'ws.asmx/getschedulerevents', type: 'post', data: { tasktype: 'completed' }, color: 'blue', textcolor: 'white' } ] }) });
webservice method:
[webmethod] public list<schedulerevent> getschedulerevents(string tasktype) { list<schedulerevent> events = new list<schedulerevent>(); if (tasktype == "todo") { events.add(new schedulerevent( 2, "eventname 1", new datetime(2013, 05, 20, 10, 00, 00).tostring(), new datetime(2013, 05, 20, 10, 00, 00).addhours(4).tostring() )); } else if (tasktype == "completed") { events.add(new schedulerevent( 1, "eventname 2", new datetime(2013, 05, 21, 11, 00, 00).tostring(), new datetime(2013, 05, 21, 11, 00, 00).addhours(3).tostring() )); } return events; }
request:
tasktype=todo&start=1368914400&end=1369519200 , tasktype=completed&start=1368914400&end=1369519200
response:
<?xml version="1.0" encoding="utf-8"?> <arrayofschedulerevent xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://tempuri.org/"> <schedulerevent> <eventid>1</eventid> <eventname>eventname 2</eventname> <startdate>2013-05-21 11:00:00</startdate> <enddate>2013-05-21 14:00:00</enddate> </schedulerevent> </arrayofschedulerevent> , <?xml version="1.0" encoding="utf-8"?> <arrayofschedulerevent xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://tempuri.org/"> <schedulerevent> <eventid>2</eventid> <eventname>eventname 1</eventname> <startdate>2013-05-20 10:00:00</startdate> <enddate>2013-05-20 14:00:00</enddate> </schedulerevent> </arrayofschedulerevent>
my question is: why request , response not in json format?
thanks
the right json format fullcalendar this:
json format feed [ { "title" : "new shift", "start" : "2010-10-25 09: 30: 00 +0100", "end" : "2010-10-25 13: 30: 00 +0100", "allday" : false }, { "title" : "new shift", "start" : "2010-10-25 08: 00: 00 +0100", "end" : "2010-10-25 14: 00: 00 +0100", "allday" : false }, { "title" : "new shift", "start" : "2010-10-25 08: 00: 00 +0100", "end" : "2010-10-25 14: 00: 00 +0100", "allday" : false }, { "title" : "new shift", "start" : "2010-10-27 08: 00: 00 +0100", "end" : "2010-10-27 13: 30: 00 +0100", "allday" : false } ]
this question don't remember one, maybe can check your's.
Comments
Post a Comment