我需要创建一个新行,将彼此相似的标题列分组,我尝试使用resourceColumns
and resourceGroupField
,但都没有成功。也许我没有很好地利用它们。
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
plugins: ['resourceTimeGrid'],
resourceGroupField: 'building',
defaultView: 'resourceTimeGridDay',
resourceColumns: [{
group: true,
labelText: 'Fabrica',
field: 'building'
},
{
labelText: 'Doca',
field: 'title'
}
],
resources: [{
id: 'a',
title: 'R16-1',
building: 'P16'
},
{
id: 'b',
title: 'R16-2',
building: 'P16'
},
{
id: 'c',
title: 'R16-3',
building: 'P16'
},
{
id: 'd',
title: 'R16-4',
building: 'P16'
},
{
id: 'e',
title: 'R19-1',
building: 'P19'
},
{
id: 'f',
title: 'R27-1',
building: 'P27'
},
{
id: 'g',
title: 'R27-2',
building: 'P27'
},
{
id: 'h',
title: 'R27-3',
building: 'P27'
},
{
id: 'i',
title: 'R27-4',
building: 'P27'
},
{
id: 'j',
title: 'R27-5',
building: 'P27'
},
{
id: 'k',
title: 'R40-1',
building: 'p40'
},
{
id: 'l',
title: 'R54-1',
building: 'P54'
},
{
id: 'm',
title: 'R56-1',
building: 'P56'
},
{
id: 'n',
title: 'R56-2',
building: 'P56'
},
],
nowIndicator: true,
});
calendar.render();
});
</script>