Scheduler Row height configuration example

React Scheduler: Row Height

Row height in React Scheduler.

A live React example of jqxScheduler, the jQWidgets Scheduler component, with its complete source code below. It is one of 44 jqxScheduler demos for React.

jqxScheduler API used in this demo

Source code

To run it in your own app, install the package with npm install jqwidgets-scripts, add these files to a Vite React and TypeScript project, and import jqx.base.css and a theme in main.tsx. Getting started with jqxScheduler shows the setup step by step.

App.tsx

import { useRef, useMemo, useCallback } from 'react';
import JqxScheduler, { jqx } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxscheduler';

interface AppointmentDataFields {
  description: string;
  from: string;
  id: string;
  location: string;
  resourceId: string;
  status: string;
  style: string;
  subject: string;
  to: string;
}

function App() {
  const myScheduler = useRef<JqxScheduler | null>(null);

  const source = useMemo(
    () => ({
      dataFields: [
        { name: 'id', type: 'string' },
        { name: 'status', type: 'string' },
        { name: 'about', type: 'string' },
        { name: 'address', type: 'string' },
        { name: 'company', type: 'string' },
        { name: 'name', type: 'string' },
        { name: 'style', type: 'string' },
        { name: 'calendar', type: 'string' },
        { name: 'start', type: 'date', format: 'yyyy-MM-dd HH:mm' },
        { name: 'end', type: 'date', format: 'yyyy-MM-dd HH:mm' }
      ],
      dataType: 'json',
      id: 'id',
      url: 'appointments.txt'
    }),
    []
  );

  const dataAdapter = useMemo(() => new jqx.dataAdapter(source), [source]);

  const appointmentDataFields: AppointmentDataFields = useMemo(
    () => ({
      description: 'about',
      from: 'start',
      id: 'id',
      location: 'address',
      resourceId: 'calendar',
      status: 'status',
      style: 'style',
      subject: 'name',
      to: 'end'
    }),
    []
  );

  const date = useMemo(() => new jqx.date(2028, 11, 17), []);

  const views = useMemo(() => ['dayView', 'weekView'], []);

  const ready = useCallback(() => {
    if (myScheduler.current) {
      const scrollHeight = myScheduler.current.scrollHeight();
      // eslint-disable-next-line no-console
      console.log('scrollHeight is ' + scrollHeight);
      myScheduler.current.scrollTop(700);
    }
  }, []);

  return (
    <JqxScheduler
      theme="tailwind-blue-dark"
      ref={myScheduler}
      width="100%"
      height={600}
      date={date}
      source={dataAdapter}
      showLegend={true}
      rowsHeight={40}
      view="weekView"
      views={views}
      appointmentDataFields={appointmentDataFields}
      ready={ready}
    />
  );
}

export default App;

Learn more

More React Scheduler demos