JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Gantt Facing difficulties with: Gantt. Suggestions welcome.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #112707
    alex.morris22
    Participant

    Can Smart Gantt be lazy-loaded in React?

    #112717
    Markov
    Keymaster

    Hi,

    Yes, Smart Gantt from Smart UI can be lazy-loaded in React using standard React features like React.lazy() and Suspense.

    import React, { Suspense } from 'react';
    
    const GanttChart = React.lazy(() => import('./SmartGanttComponent'));
    
    function App() {
      return (
        <div>
          <h2>Project Timeline</h2>
          <Suspense fallback={<div>Loading Gantt chart...</div>}>
            <GanttChart />
          </Suspense>
        </div>
      );
    }
    
    export default App;

    and SmartGanttComponent is

    import React from 'react';
    import 'smart-webcomponents-react/source/styles/smart.default.css';
    import { GanttChart } from 'smart-webcomponents-react/ganttchart';
    
    const SmartGanttComponent = () => {
      return (
        <GanttChart
          treeSize="30%"
          durationUnit="hour"
          dataSource={[]}
          taskColumns={[
            { label: 'Task Name', value: 'label' },
            { label: 'Start', value: 'dateStart' },
            { label: 'End', value: 'dateEnd' }
          ]}
        />
      );
    };
    
    export default SmartGanttComponent;

    Hope this helps.

    Best regards,
    Markov

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.