具體事件我有一個JSON飼料全部數據的下頁:如何顯示從JSON飼料
'./PlanningFeed.xhtml'
我可以給一個基本的使用fullcalendar數據,並將其工作。
問題是我想只顯示滿足條件的事件。
這是我得到的JSON數據:
eventSources: [
{
url: './PlanningFeed.xhtml',
type: 'GET',
data: {
start: firstdate,
end: lastdate,
salle: salle //this is my attempt to get only events that has a specific
//"salle" attribute,the field salle is declared and populated
//in all event objects.
//but this parameter here it doesn't affect
//anything and my calendar is created with all salle events showed.
//which means this doesn't work.
}
}
]
});
此外,我嘗試了eventRender
卻無濟於事:
eventRender: function(event, element) {
if (event.salle === salle) {
console.log('added', event.salle);
} else if (event.salle !== salle) {
console.log('deleted', event.salle);
$(placeholder).fullCalendar('removeEvents', event.id);
}
}
我不想從JSON提要我可以刪除數據稍後使用它。我希望如果我能查詢JSON提要只顯示我想要的事件(例如:event.salle ='XYZ')。
請不要猶豫,詢問更多信息。
更新1:
[{"title":"uiyuiyutyiyuity\nANGIO SCANNER RENALE.","start":"2014-12-01T07:30:00","end":"2014-12-01T07:45:00","salle":"SCANNER1","backgroundColor":"#B6E8FF","patState":4,"rapportWrittenState":0,"patientFullName":"uiyuiyutyiyuity","studyDureeMinute":15,"payStateImage":"non-cote","bannerColor":"#98d1ec","borderColor":"#98d1ec","id":"1"},
{"title":"hjghjghjghj\n2 CHEVILLE F","start":"2014-12-01T07:15:00","end":"2014-12-01T07:35:00","salle":"RADIO 1","backgroundColor":"#CDDFED","patState":1,"rapportWrittenState":0,"patientFullName":"hjghjghjghj","studyDureeMinute":20,"payStateImage":"non-cote","bannerColor":"#a0c2dc","borderColor":"#a0c2dc","id":"2"},
{"title":"yiyuiyuiyui\nANGIO SCANNER ABDOMINALE.","start":"2014-12-01T06:55:00","end":"2014-12-01T07:15:00","salle":"SCANNER1","backgroundColor":"#F0F0F0","patState":7,"rapportWrittenState":0,"patientFullName":"yiyuiyuiyui","studyDureeMinute":20,"payStateImage":"non-cote","bannerColor":"#C8C8C8","borderColor":"#C8C8C8","id":"3"},
{"title":"tuutyuj\nANGIO SCANNER CEREBRAL.","start":"2014-12-01T06:25:00","end":"2014-12-01T06:45:00","salle":"SCANNER1","backgroundColor":"#E8F5BB","patState":5,"rapportWrittenState":0,"patientFullName":"tuutyuj","studyDureeMinute":20,"payStateImage":"non-cote","bannerColor":"#cede97","borderColor":"#cede97","id":"4"},
{"title":"dfgdfgdfgdfg\nANGIO SCANNER CERVICAL.","start":"2014-12-01T06:00:00","end":"2014-12-01T06:20:00","salle":"SCANNER1","backgroundColor":"#FFC592","patState":3,"rapportWrittenState":0,"patientFullName":"dfgdfgdfgdfg","studyDureeMinute":20,"payStateImage":"c_valider","bannerColor":"#e8a66c","borderColor":"#e8a66c","id":"5"}]
你可以顯示你的json返回的示例代碼嗎? – Kristiyan 2014-12-03 11:58:12
肯定會看到更新1. – 2014-12-03 11:59:36
,而不是要求完整的日曆來觸發ajax,你不能只發送請求,獲取數據,過濾數據,將它保存在一個數組中,並將其作爲完整日曆的輸入? – 2014-12-03 12:10:58