Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #113311
    emily.thorne91
    Participant

    Can I use Smart Gantt with a REST API?

    #113316
    admin
    Keymaster

    Hi,

    Smart Gantt is UI-only, so it doesn’t talk to REST services by itself—but it’s designed to bind easily to data coming from a REST API and to sync changes back.

    How it works (high level)

    Fetch data from your REST API (tasks, dependencies, resources)

    Map the response to the Smart Gantt task structure

    Load it into the component

    Listen for changes (add/update/delete)

    Send updates back to your API

    This works the same way in JavaScript, Angular, React, Vue, and Blazor.

    Typical REST → Smart Gantt data flow
    REST API ⇄ Frontend logic ⇄ Smart Gantt

    Smart Gantt focuses on:

    Visualization

    Editing

    Scheduling logic

    Your app handles:

    Data fetching

    Persistence

    Authentication

    Business rules

    Example (JavaScript)
    fetch(‘/api/tasks’)
    .then(res => res.json())
    .then(data => {
    gantt.tasks = data.map(task => ({
    id: task.id,
    label: task.name,
    startDate: task.start,
    endDate: task.end,
    progress: task.progress
    }));
    });

    Sending changes back to the API

    Smart Gantt fires events when data changes.

    gantt.addEventListener(‘change’, event => {
    fetch(/api/tasks/${event.detail.id}, {
    method: ‘PUT’,
    headers: { ‘Content-Type’: ‘application/json’ },
    body: JSON.stringify(event.detail)
    });
    });

    You can handle:

    Task updates

    New tasks

    Deletions

    Dependency changes

    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.