gpt4 book ai didi

javascript - 如何显示 JSON feed 中的特定事件

转载 作者:行者123 更新时间:2023-12-03 11:17:31 25 4
gpt4 key购买 nike

我在以下页面上有一个充满数据的 JSON 提要:

'./PlanningFeed.xhtml'

我可以在基本使用情况全日历上显示数据,并且它正在工作。

问题是我只想显示满足条件的事件。

这就是我获取 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 feed 中删除数据,我稍后可能会使用它。我希望我可以查询 JSON feed 以仅显示我想要的事件(例如: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"}]

最佳答案

我不太擅长完整日历,但我找到了解决您问题的方法

删除事件后,您必须重新渲染所有事件:

$(placeholder).fullCalendar('removeEvents', event.id);
setTimeout(function(){
$(placeholder).fullCalendar("rerenderEvents");
},1);

我肯定使用超时。正在测试 fullcalendar-2.2.3 全新下载。

编辑:确保您的变量和 if 条件。

关于javascript - 如何显示 JSON feed 中的特定事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27271028/

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