【发布时间】:2020-08-12 11:40:26
【问题描述】:
我正在使用 fullcalendar-Scheduler 5.2。
如何展开或折叠资源组? 我知道 resourcesInitiallyExpanded 功能,但我想展开/折叠特定的资源组。
我找到了一个例子: https://codepen.io/anon/pen/odNOWZ?editors=0010 但这是针对旧版本的 Fullcalendar。
viewRender: function(view) {
$('#calendar .fc-divider .fc-cell-text').each(function(index, area_text_el) {
if (area_text_el.innerText === 'Auditorium A') {
$(area_text_el).siblings('.fc-expander').click()
}
})
我将使用 resourceGroupLabelDidMount 钩子,它给了我这个参数:
当上述钩子以function(arg)形式指定为函数时,arg是具有以下属性的对象:
组值
el - 元素。仅在 resourceGroupLabelDidMount、resourceGroupLabelWillUnmount、resourceGroupLaneDidMount 和 resourceGroupLaneWillUnmount 中可用
但是在哪里可以调用点击函数呢?
谢谢!
【问题讨论】:
-
您需要确定哪个元素是可点击的,然后在回调函数中调用其点击函数(使用 jQuery 或 vanilla JS)。与您找到的旧示例相同的想法,除了 HTML 结构可能已更改 - 您需要首先使用浏览器的元素检查器进行检查。
-
是的,谢谢,我研究了一下,发现名称已更改。而且我不知道如何调用 css 函数,但经过一些研究,我发现了“querySelector”。现在它的工作
标签: javascript fullcalendar fullcalendar-scheduler fullcalendar-5