Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7807563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:53:22+00:00 2026-06-02T02:53:22+00:00

I am using JQuery Full Calendar along with Spring MVC. Hello, I have made

  • 0

I am using JQuery Full Calendar along with Spring MVC.

Hello,
I have made a demo like that.

Target: I need when the user clicks on an event s/he already inserted,a dialog box appears and gives him/her the capability to either remove that event or cancel.

Issue: Now whenever the user clicks on any day, a dialog appears to allow the user to enter title for that event then user clicks “Ok” to save that event.

Freemarker:
Freemarker:

<script type="text/javascript">
    var resourceVacation;

    function censor(censor) {
        return (function() {
            var i = 0;
            return function(key, value) {
                if (i !== 0 && typeof(censor) === 'object' && typeof(value) == 'object' && censor == value)
                    return '[Circular]';                   

                ++i; // so we know we aren't using the original object anymore

                return value;
            }
        })(censor);
    }


    function doAjax() {

        $.each(resourceVacation, function(index) {
            var tmpDate = resourceVacation[index].start;
            tmpDate.setHours(tmpDate.getHours() - tmpDate.getTimezoneOffset() / 60);
            resourceVacation[index].start=tmpDate;

        });
//        var arrays = [
//            {"id":111,"title":"event1","start":"2012-04-15T22:00:00.000Z","url":"http://yahoo.com/"}
//        ];
//        var objects = {"id":111,"title":"event2","start":"2012-04-16T22:00:00.000Z","url":"http://yahoo2.com/"};
//
//        arrays.push(objects);
        var test = JSON.stringify(resourceVacation, censor(resourceVacation));
        var x = test;
        $.ajax(
        {
            url:"[@spring.url '/vacation/saveResourceVacation'/]",
            type: "POST",
            data :x ,
            dataType: "json",
            contentType: "application/json"
        });
    }


    $(document).ready(function() {

        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();
        $.getJSON('[@spring.url '/vacation/loadResourceVacation'/]', function (data) {
            var calendar = $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                selectable: true,
                selectHelper: true,
                select:
                        function(start, end, allDay) {
                            var title = prompt('Event Title:');

                            if (title) {
                                start.setHours(start.getHours() - start.getTimezoneOffset() / 60);
//                                var dat=$.fullCalendar.formatDate( start, "yyyy/MM/dd")


                                var newVacation= {id:133,title:'title',start:start,url: 'title'};
                                resourceVacation.push(newVacation);
                                calendar.fullCalendar('renderEvent',
                                {
                                    title: title,
                                    start: start,
                                    end: end,
                                    allDay: allDay
                                },
                                        true // make the event "stick"
                                        );
                            }
                            calendar.fullCalendar('unselect');
                        },
         eventClick: function(calEvent, jsEvent, view) {

            alert('Event: ' + calEvent.title);
            alert('start: ' + calEvent.start);             
        }

                editable: true,
                events:data
            });
            resourceVacation = data;
        });
    });


</script>

Controller:

     @RequestMapping(value = "/vacation/loadResourceVacation", method = RequestMethod.GET)
        public
        @ResponseBody
        String loadResourceVacation(HttpServletResponse response) throws Exception {


            //Here I build my vacationFormBean
            List<VacationFormBean> vacationFormBeanList= buildVacationFormBean();
            // Convert to JSON string.
            String json = new Gson().toJson(vacationFormBeanList);

            // Write JSON string.
            response.setContentType("application/json");
            response.setCharacterEncoding("UTF-8");       

        return json;
    }

    @RequestMapping(value = "/vacation/saveResourceVacation", method = RequestMethod.POST)
    public
    @ResponseBody
    void saveResourceVacation(@RequestBody String jsonString, Principal principal) throws Exception {
        List<String> resourceVacations = extractVacationDatesFromJsonObject(jsonString);

    }

VacationFormBean:

public class VacationFormBean {
    int id; // (With Setter & Getter)
    String title; // (With Setter & Getter)
    String start;  // (With Setter & Getter)
    String url; // (With Setter & Getter)
}

I need something like that :

enter image description here

======================UPDATE=========================

I have add the click event as a result of domi27 recomendation.
Kindly review the freemarker updates.
I have added a java script method that uses :http://arshaw.com/fullcalendar/docs/event_data/removeEvents/

The new JS method :

   $('#calendar').fullCalendar('removeEvents', 1);

This method works perfectly with the events that was initially loaded from the controller.
However,whenever I try to use the same method to remove the new events I have just added,Nothing happens.
When I fire the “select event” for the new event I created ,I get for its id”undefined”.

As I’ve mentiond on my freemarker,that are the lines I use to build the new event object that I aappend to the list.

var newVacation = {id:'133',title:'title',start:start,url: 'title'};
                                    resourceVacation.push(newVacation);

When I debug my script,I observe a difference among the objects loaded from the controller and the new object I created when the user adds a new event.

Here is the old object I got from the controller when I initiated the calendar:
enter image description here

Here is the new Object I got after I insert the new event:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:53:24+00:00Added an answer on June 2, 2026 at 2:53 am

    You may implement it like this :

    1. Fetch click on an event
    2. Display information about (how to) delete this event
    3. Call an ajax request to process deletion of event in backend
    4. Delete event from calendar frontend

    1) First is described here : http://arshaw.com/fullcalendar/docs/mouse/eventClick/

    2) Quite simpliest JS: confirm(“Really want to delete this event ?”)

    3) Call a delete action via jQuery likely as you do to save a reservation

    4) Remove this event via fullcalendars “removeEvents” method : http://arshaw.com/fullcalendar/docs/event_data/removeEvents/

    Here’s a short and very basic example :

    eventClick: function(calEvent, jsEvent, view) {
        /**
         * calEvent is the event object, so you can access it's properties
         */
        if(confirm("Really delete event " + calEvent.title + " ?")) {
            // delete event in backend
            jQuery.post(
                "/vacation/deleteEvent"
                , { "id": calEvent.id }
            );
            // delete in frontend
            calendar.fullCalendar('removeEvents', calEvent.id);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using asp mvc 3, jquery full calendar, ms sql sever 2008 and
I am using asp.net mvc 3 and jquery 1.5.2 with jquery full calendar 1.5.1
I have a full path to an image, which I am using jQuery to
Hello I'm using the fullcalendar jQuery plugin to create a calendar app. When I
I am using jQuery Full calendar. But I am not getting how to set
I am currently using the Full Calendar JQuery plugin on my webpage. I am
I'm using full calender and I have a few events that are all day
I am using jquery full calendar and one of the things it has is
I'm using jQuery ui Datepicker to display a yearly inline calendar full of special
I am trying to implement jquery full calendar with json event updates. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.