React UI Components Documentation

ReactJS Scheduler Component

The Scheduler component for ReactJS represents a widget, which displays a set of Appointments in Day, Week, Month, Timeline Day, Timeline Week and Timeline Month views.

Prerequisites

Refer to ReactJS Getting Started before you start with this help topic.

Configuration

The Scheduler component for ReactJS requires the following imports.

 
import React from 'react';
import ReactDOM from 'react-dom';
import JqxScheduler from 'jqwidgets-react/react_jqxscheduler.js';

Then we create our component class. Properties and methods are put as ReactJS props.

  
class App extends React.Component {
render () {
let appointments = new Array();
let appointment1 = {
id: "id1",
description: "George brings projector for presentations.",
location: "",
subject: "Quarterly Project Review Meeting",
calendar: "Room 1",
start: new Date(2016, 10, 23, 9, 0, 0),
end: new Date(2016, 10, 23, 16, 0, 0)
};
let appointment2 = {
id: "id2",
description: "",
location: "",
subject: "IT Group Mtg.",
calendar: "Room 2",
start: new Date(2016, 10, 24, 10, 0, 0),
end: new Date(2016, 10, 24, 15, 0, 0)
};
appointments.push(appointment1);
appointments.push(appointment2);
let source =
{
dataType: "array",
dataFields: [
{ name: 'id', type: 'string' },
{ name: 'description', type: 'string' },
{ name: 'location', type: 'string' },
{ name: 'subject', type: 'string' },
{ name: 'calendar', type: 'string' },
{ name: 'start', type: 'date' },
{ name: 'end', type: 'date' }
],
id: 'id',
localData: appointments
};
let dataAdapter = new $.jqx.dataAdapter(source);
let resources =
{
colorScheme: "scheme05",
dataField: "calendar",
orientation: "horizontal",
source: new $.jqx.dataAdapter(source)
};
let appointmentDataFields =
{
from: "start",
to: "end",
id: "id",
description: "description",
location: "place",
subject: "subject",
resourceId: "calendar"
};
let views =
[
{ type: 'dayView', showWeekends: false },
{ type: 'weekView', showWeekends: false },
{ type: 'monthView' }
];
return (
<JqxScheduler ref='myScheduler'
width={850} height={600} source={dataAdapter} dayNameFormat={'abbr'}
date={new $.jqx.date(2016, 11, 23)} showLegend={true}
view={'weekView'} resources={resources} views={views}
appointmentDataFields={appointmentDataFields}
/>
)
}
}

Finally we render our class in the desired HTML element:

 
ReactDOM.render(<App />, document.getElementById('app'));

Events Methods & Properties

In order to bind to any event, change any property or call any method, we need a reference to the component.
For that we use the ReactJS "ref" Callback Attribute:

 
<JqxScheduler ref='myScheduler' width={850} height={600} source={dataAdapter}...../>

Now, when we have a reference, we need to call the desired event/property/method.
This is done in the componentDidMount() ReactJS Component Lifecycle method.

Events

The cellClick event is triggered when a cell is clicked.

The following example demonstrates how to add an event listener:

Methods & Properties

This is how you call methods & props:

Every component have a method setOptions which accepts a object as an argument. This object contains component settings.

Every component also have a method getOptions which returns a object containing the component settings.

Scheduler Examples

Overview

The following example demonstrates how to create a Scheduler component.

Resources

This following example demonstrates a way to separate the data in two (or more) parts horizontally.

Scheduler API

API Reference of the jQWidgets Scheduler component for React: Scheduler API