fullcalendar.js - deleting event on button click

后端 未结 5 1692
猫巷女王i
猫巷女王i 2021-02-02 15:36

I am using the fullCalendar.js and the current problem is making i lose so much time on something that might be simple to whose understand javascript (more specific jquery) bett

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-02 16:17

    The way i found:

    //HTML Code to add the button
    
    

    -

    //Our Js data
    {id: '1', resourceId: 'a' , start: '2015-10-16T10:52:07', end: '2015-10-16T21:00:00', url: 'https//www.google.com', title: 'How to delete Events'},
    {id: '2', resourceId: 'b' , start: '2015-10-16T11:00:10', end: '2015-10-18T17:03:00', title : 'Can we delete multiple events ?'},
    {id: '2', resourceId: 'c' , start: '2015-10-16T10:00:00', end: '2015-10-16T23:00:02', title : 'How ?'},
    ],
    
    //Need to set our button
    select: function(start, end, jsEvent, view, resource) {
            console.log(
            'select callback',
            start.format(),
            end.format(),
            resource ? resource.id : '(no resource)'
            );
            }
            });
    
            //Our button to delete Events
            $('#Delete').on('click', function() {
            $('#calendar').fullCalendar('removeEvents', 2); //Remove events with the id: 2
                });
    
     });
    

提交回复
热议问题