Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am able to change [fullcalendar] resources but unable to change events(header of calendar).

What I have tried:

C#
var data = {
            startDate: $("#EventDate").val(),
            regionID: parseInt($("#SubRegion").val()),
            subTypeID: parseInt($("#Subtype").val()),
        };
        var events = {
            url: "@Url.Action("RefreshCalendar", "Ecom")",
            type: 'POST',
            data: data
        }
 $('#calendar').fullCalendar('removeEvents');
 $('#calendar').fullCalendar('addEventSource', event);
Posted
Updated 23-Sep-16 4:07am
v2
Comments
David_Wimbley 23-Sep-16 9:09am    
What do you mean by "change events (header of calendar)"
itsathere 23-Sep-16 9:22am    
If you see the demo fullcalendar header of calendar show Sun/Mon/Tue/Wed/Thu/Fri/Sat.In my case all these days are places which is dynamic and I need to change it dynamically.
David_Wimbley 23-Sep-16 9:28am    
Why would you want to change the header of those days? Is monday no longer monday?

Anyways, it looks like the headers have classes. Can't you just do

$(".fc-wed").html("Tuesday"); and now you've made the Wed header become Tues.
itsathere 23-Sep-16 9:52am    
City1 city2 city3 city4 city5 ... these are dynamic header in place of Sun/Mon/Tue/Wed/Thu/Fri/Sat

and I need to change it dynamically onchange in dropdownlist.
below is url of snap shot
http://imgur.com/FnHkZ7x
David_Wimbley 23-Sep-16 9:58am    
Again, City1 can correspond to Monday, so why not just do what I said

$(".fc-wed").html("City2");

1 solution

try this

JavaScript
eventAfterAllRender: function () {
			    var map ={Sun:'City1',Mon:'City2',Tue:'City3',Wed:'City4',Thu:'City5',Fri:'City6',Sat:'City7'};
			    $('.fc-widget-header th').each(function (i,elem) {
			        var newText = map[$(elem).text()];                   
			        $(elem).text(newText);
			    });
			}
 
Share this answer
 
Comments
itsathere 23-Sep-16 10:21am    
I have dynamic lots of data to bind in header not only 7.When 1st time I load calendar then fullcalendar binds data correctly because I am providing json databut on search it should be change dynamically.So, header will be dynamic.
Karthik_Mahalingam 23-Sep-16 10:27am    
a week view has only 7 columns
itsathere 23-Sep-16 10:37am    
But I need it dyanamic try to understand the situation.Btw thanks for your valuable time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900