Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 31 additions & 24 deletions content/docs/plugins/plugin-gantt.mdx
Original file line numberDiff line numberDiff line change
Expand Up@@ -121,11 +121,16 @@ const schema = {
staticData?: Array<any>, // Static data array
data?: ViewData, // Advanced data configuration
gantt?: GanttConfig, // Gantt-specific configuration
onTaskClick?: (record: any) => void,
className?: string
viewMode?: 'day' | 'week' | 'month' | 'quarter' | 'year',
readOnly?: boolean // disable every edit path
}
```

`onTaskClick` and `className` are **React props on `<ObjectGantt>`**, not schema
keys — the renderer never reads them off the schema, and a function cannot
survive serializable metadata anyway. `viewMode` is read through the gantt
config, so it applies alongside a `gantt` block or the flat `*Field` keys.

### GanttConfig

```plaintext
Expand DownExpand Up@@ -243,8 +248,9 @@ The dependencies field should contain an array of task IDs that this task depend
type: 'object-gantt',
data: {
provider: 'api',
endpoint: '/api/project/tasks',
method: 'GET'
// the api member is `read` / `write` HTTP requests — there is no
// top-level `endpoint` key, and nothing reads one
read: { url: '/api/project/tasks', method: 'GET' }
},
gantt: {
startDateField: 'startDate',
Expand All@@ -265,24 +271,31 @@ bare global fetch and rely on same-origin cookies alone.

### Task Click

The click handler is a **React prop**, not a schema key — the schema stays
serializable:

```tsx
{
type: 'object-gantt',
objectName: 'tasks',
gantt: {
startDateField: 'start',
endDateField: 'end',
titleField: 'name'
},
onTaskClick: (task) => {
<ObjectGantt
schema={{
type: 'object-gantt',
objectName: 'tasks',
gantt: {
startDateField: 'start',
endDateField: 'end',
titleField: 'name'
}
}}
dataSource={dataSource}
onTaskClick={(task) => {
console.log('Task clicked:', task);
// Open task details
// Edit task
// Show task dependencies
}
}
// Open task details / edit / show dependencies
}}
/>
```

Rendered through the registered `object-gantt` type there is usually nothing to
wire: clicking a row already opens the standard detail drawer.

## Examples

### Software Project
Expand All@@ -297,9 +310,6 @@ const softwareProject = {
titleField: 'taskTitle',
progressField: 'completionPercent',
dependenciesField: 'blockedBy'
},
onTaskClick: (task) => {
// Show task details modal
}
}
```
Expand All@@ -315,9 +325,6 @@ const constructionGantt = {
endDateField: 'phase_end',
titleField: 'phase_name',
progressField: 'percent_complete'
},
onTaskClick: (phase) => {
// Navigate to phase details
}
}
```
Expand Down
Loading