Click here to Skip to main content
15,905,419 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello frnds,

I am using full calendar API for viewing the events in my project. now project requirement change and need to add new view named resource. I tried with google but not get success result for this.

have you any one idea about this.

Thanks in advance.
Posted
Updated 22-Oct-13 19:53pm
v2
Comments
Sergey Alexandrovich Kryukov 23-Oct-13 0:35am    
Excuse me, what is "calander"?
—SA
ExpertITM 23-Oct-13 1:54am    
sorry its spell mistake.

1 solution

First of all i would like to suggest you the User Manual[^] for Resource-Calender.
Now
Resources :: Introduces available resources to calendar. Resource id links to Event objects resource property. Event objects resource can be also an array! This is a basic JSON-array which includes resource name and id. It can also include readonly boolean which sets resource readonly.

For example:
JavaScript
resources: [
    {
    	name: 'Resource 2',
    	id: 'resource2'
    },
    {
    	name: 'Resource 1',
    	id: 'resource1',
    	readonly: true 
    }
    ],
    events: [	
    {
    	title: 'Long Event',
    	start: new Date(y, m, d-5),
    	end: new Date(y, m, d-2),
    	resource: 'resource1'
    },
    {
    	title: 'Meeting',
    	start: new Date(y, m, d, 10, 30),
    	allDay: false,
    	resource: ['resource4','resource2']
    }	
    ],

You can also insert a URL in the resources option (like in events):
resources: 'http://hostname/jsonresources.php'

Weekend headers in different color? :: You can use class fc-weekend to affect to weekend headers and fc-weekend-column for weekend columns for example background color.

A VERY simple way to pass multiple resources to FullCalendar with PHP

PHP
// This is a sample array
$resources = array(
		array("name" => "Resource 1", id => "resource1"),
		array("name" => "Resource 2", id => "resource2")
		);

// json_encode encodes array
$resources_JSON_array = json_encode($resources);

//...and then in Fullcalendar JavaScript:
resources: $resources_JSON_array,
A VERY simple way to pass multiple resources to FullCalendar with jQuery ajax
// In Fullcalendar options you provide URL. Fullcalendar will request this page via ajax:
resources: 'getResources.php',

// getResources.php echoes JSON array
$resources = array(
		array("name" => "Resource 1", id => "resource1"),
		array("name" => "Resource 2", id => "resource2")
		);
echo json_encode($resources);

External events and resources example:
When using external events, you can get resource data this way:
drop: function(date, allDay, ev, ui, resource) {
	var resourceId = resource.id; // this is resource id
	var resourceName = resource.name // this is resource name
	
	//YEAH!
}

and still if your not getting it then please Visit This Link.[^] Download the sample code and try your variation solution.
 
Share this answer
 
v2

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