Skip to content

Commit 91f85b2

Browse files
authored
docs(gantt):edit popup customization (#813)
1 parent 8eeebe1 commit 91f85b2

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ navigation:
8888
"*components/gantt/gantt-tree/columns":
8989
title: "Columns"
9090
position: 7
91+
"*components/gantt/gantt-tree/editing":
92+
title: "Editing"
93+
position: 10
9194
"*components/gantt/gantt-tree/filter":
9295
title: "Filtering"
9396
position: 25

components/gantt/gantt-tree/editing/popup.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ position: 15
1010

1111
# Gantt Tree Popup Editing
1212

13+
In this article:
14+
15+
* [Basics](#basics)
16+
* [Customization](#customization)
17+
18+
## Basics
19+
1320
Popup editing lets the user click an [Edit command button]({%slug components/grid/columns/command%}) on the row, and a popup shows up with the editable fields associated with a Gantt Task. They can then click the `Save` button in the dialog to submit the changes to the model. This fires the `OnUpdate` event where your code receives the updated model so you can work with the data (for example, to call the appropriate method of your service).
1421

1522
In a similar fashion, the `Cancel`, `Delete` command buttons and the `Add` toolbar button fire events to let you handle the data source operations.
@@ -247,6 +254,141 @@ To enable PopUp editing in the Gantt Tree, set its `TreeListEditMode` property t
247254

248255
>note It is up to the data access logic to save the data once it is changed in the data collection, or to revert changes. The example above showcases the events that allow you to do that. In a real application, the code for handling data operations may be entirely different.
249256
257+
## Customization
258+
259+
The Gantt exposes options to customize the edit popup and its form. You can define your desired configuration in the `GanttPopupEditSettings` and `GanttPopupEditFormSettings` tags under the `GanttSettings` tag.
260+
261+
### Popup Customization
262+
263+
The `GanttPopupEditSettings` nested tag exposes the following parameters to allow popup customization:
264+
265+
@[template](/_contentTemplates/common/popup-edit-customization.md#popup-settings)
266+
267+
### Edit Form Customization
268+
269+
The `GanttPopupEditFormSettings` nested tag exposes the following parameters to allow edit form customization:
270+
271+
Parameter | Type | Description
272+
---------|----------|---------
273+
`Columns` | `int` | The count of the columns
274+
`ColumnSpacing` | `int` | The column spacing
275+
`Orientation` | `FormOrientation` <br/> (`Vertical`) | The orientation of the form. Takes a member of the `FormOrientation` enum: <br/> - `Horizontal` <br/> - `Vertical`
276+
277+
>caption Customize the popup edit form
278+
279+
````CSHTML
280+
@*The snippet focuses on the popup edit form customization. CRUD events are not handled for brevity*@
281+
282+
<TelerikGantt Data="@Data"
283+
@bind-View="@SelectedView"
284+
TreeListEditMode="@GanttTreeListEditMode.Popup"
285+
Width="1000px"
286+
Height="600px"
287+
IdField="Id"
288+
ParentIdField="ParentId">
289+
<GanttSettings>
290+
<GanttPopupEditSettings Width="700px"
291+
MinWidth="650px"
292+
MaxHeight="300px"
293+
Class="custom-popup">
294+
</GanttPopupEditSettings>
295+
<GanttPopupEditFormSettings Orientation="@FormOrientation.Horizontal"
296+
Columns="2"
297+
ColumnSpacing="50px">
298+
</GanttPopupEditFormSettings>
299+
</GanttSettings>
300+
<GanttToolBar>
301+
<GanttCommandButton Command="Add" Icon="add">Add</GanttCommandButton>
302+
</GanttToolBar>
303+
<GanttColumns>
304+
<GanttCommandColumn Width="110px">
305+
<GanttCommandButton Command="Add" Icon="add"></GanttCommandButton>
306+
<GanttCommandButton Command="Edit" Icon="edit"></GanttCommandButton>
307+
<GanttCommandButton Command="Delete" Icon="delete"></GanttCommandButton>
308+
</GanttCommandColumn>
309+
<GanttColumn Field="Title"
310+
Expandable="true"
311+
Width="160px"
312+
Title="Task Title">
313+
</GanttColumn>
314+
<GanttColumn Field="PercentComplete"
315+
Title="Status"
316+
Width="60px">
317+
</GanttColumn>
318+
<GanttColumn Field="Start"
319+
Width="100px"
320+
DisplayFormat="{0:d}">
321+
</GanttColumn>
322+
<GanttColumn Field="End"
323+
Width="100px"
324+
DisplayFormat="{0:d}">
325+
</GanttColumn>
326+
</GanttColumns>
327+
<GanttViews>
328+
<GanttDayView></GanttDayView>
329+
<GanttWeekView></GanttWeekView>
330+
<GanttMonthView></GanttMonthView>
331+
</GanttViews>
332+
</TelerikGantt>
333+
334+
@code {
335+
public GanttView SelectedView { get; set; } = GanttView.Week;
336+
337+
List<FlatModel> Data { get; set; }
338+
339+
class FlatModel
340+
{
341+
public int Id { get; set; }
342+
public int? ParentId { get; set; }
343+
public string Title { get; set; }
344+
public double PercentComplete { get; set; }
345+
public DateTime Start { get; set; }
346+
public DateTime End { get; set; }
347+
}
348+
349+
public int LastId { get; set; } = 1;
350+
351+
protected override void OnInitialized()
352+
{
353+
Data = new List<FlatModel>();
354+
var random = new Random();
355+
356+
for (int i = 1; i < 6; i++)
357+
{
358+
var newItem = new FlatModel()
359+
{
360+
Id = LastId,
361+
Title = "Task " + i.ToString(),
362+
Start = new DateTime(2021, 7, 5 + i),
363+
End = new DateTime(2021, 7, 11 + i),
364+
PercentComplete = Math.Round(random.NextDouble(), 2)
365+
};
366+
367+
Data.Add(newItem);
368+
var parentId = LastId;
369+
LastId++;
370+
371+
for (int j = 0; j < 5; j++)
372+
{
373+
Data.Add(new FlatModel()
374+
{
375+
Id = LastId,
376+
ParentId = parentId,
377+
Title = " Task " + i + " : " + j.ToString(),
378+
Start = new DateTime(2021, 7, 5 + j),
379+
End = new DateTime(2021, 7, 6 + i + j),
380+
PercentComplete = Math.Round(random.NextDouble(), 2)
381+
});
382+
383+
LastId++;
384+
}
385+
}
386+
387+
base.OnInitialized();
388+
}
389+
}
390+
````
391+
250392
## See Also
251393

252394
* [Live Demo: Gantt Popup Editing](https://demos.telerik.com/blazor-ui/gantt/editing-popup)

0 commit comments

Comments
 (0)