diff --git a/blazor-toc.html b/blazor-toc.html index 57a9495437..6b996808d2 100644 --- a/blazor-toc.html +++ b/blazor-toc.html @@ -1523,6 +1523,7 @@
  • Header
  • Footer
  • Templates
  • +
  • Speech to Text
  • Appearance
  • Globalization
  • Accessibility
  • @@ -1784,6 +1785,9 @@
  • Accessibility
  • +
  • + Customization +
  • Data Source
  • @@ -2858,6 +2862,7 @@
  • Popup Setting
  • Style and Appearance
  • Accessibility
  • +
  • Customization
  • Localization
  • API Reference @@ -2978,7 +2983,8 @@
  • File Source
  • Template
  • Validation
  • -
  • Style and Appearance
  • +
  • Form Integration
  • +
  • File Upload Customization
  • Http Client
  • How To
  • @@ -3086,7 +3091,7 @@
  • Editing Tasks
  • Deleting Tasks
  • Taskbar Editing
  • -
  • Split Task
  • +
  • Splitting and Merging Tasks
  • Indent and Outdent
  • Entity Framework
  • @@ -3105,6 +3110,7 @@
  • Filtering @@ -3637,6 +3643,8 @@
  • Sorting
  • Grouping
  • Custom Value
  • +
  • Data Source
  • +
  • Events
  • Virtualization
  • Templates
  • Multicolumn MultiSelect Dropdown
  • @@ -4316,6 +4324,7 @@
  • User Interaction
  • Appearance
  • Globalization
  • +
  • Localization
  • Accessibility
  • Events
  • Methods
  • diff --git a/blazor/ai-coding-assistant/mcp-server.md b/blazor/ai-coding-assistant/mcp-server.md index dea24d6e41..5062680f78 100644 --- a/blazor/ai-coding-assistant/mcp-server.md +++ b/blazor/ai-coding-assistant/mcp-server.md @@ -234,4 +234,4 @@ Product support is available through the following mediums. ## See also -* [Syncfusion Blazor Documentation](https://blazor.syncfusion.com/documentation) +* [Syncfusion Blazor Documentation](https://blazor.syncfusion.com/documentation) \ No newline at end of file diff --git a/blazor/appearance/icons.md b/blazor/appearance/icons.md index fb5b7efe4f..585d7161af 100644 --- a/blazor/appearance/icons.md +++ b/blazor/appearance/icons.md @@ -201,38 +201,48 @@ The complete pack of Syncfusion® Blazor ico + + +### Bootstrap 5 + + + +### Fluent 2 + + + ### Material 3 - + -### Bootstrap 5 +### Tailwind 3 - + ### Bootstrap 4 - + ### Bootstrap - + + +### Fluent + + ### Material - + ### Tailwind CSS - + ### Office Fabric - + ### High Contrast - - -### Fluent - - + diff --git a/blazor/chat-ui/images/chatui-stt.png b/blazor/chat-ui/images/chatui-stt.png new file mode 100644 index 0000000000..e452c81b6c Binary files /dev/null and b/blazor/chat-ui/images/chatui-stt.png differ diff --git a/blazor/chat-ui/speech-to-text.md b/blazor/chat-ui/speech-to-text.md new file mode 100644 index 0000000000..1e8833492d --- /dev/null +++ b/blazor/chat-ui/speech-to-text.md @@ -0,0 +1,215 @@ +--- +layout: post +title: Speech-to-Text with Blazor Chat UI Component | Syncfusion +description: Checkout and learn about Speech-to-Text configuration with Blazor Chat UI component in Blazor Server App and Blazor WebAssembly App. +platform: Blazor +control: Chat UI +documentation: ug +--- + +# Speech-to-Text in Blazor Chat UI + +The Syncfusion Blazor Chat UI component integrates `Speech-to-Text` functionality through the browser's [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API). This enables the conversion of spoken words into text using the device's microphone, allowing users to interact with the Chat UI through voice input. + +## Configure Speech-to-Text + +To enable Speech-to-Text functionality in the Blazor Chat UI component, update the `Home.razor` file to incorporate the Web Speech API. + +The [SpeechToText](https://blazor.syncfusion.com/documentation/speech-to-text/getting-started-web-app) component listens to audio input from the device’s microphone, transcribes spoken words into text, and updates the Chat UI’s editable footer using the [FooterTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.InteractiveChat.SfChatUI.html#Syncfusion_Blazor_InteractiveChat_SfChatUI_FooterTemplate) tag directive to display the transcribed text. Once the transcription appears in the footer, users can send it as a message to others. + +### Configuration Options + +* **[`Language`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Inputs.SfSpeechToText.html#Syncfusion_Blazor_Inputs_SfSpeechToText_Language)**: Specifies the language for speech recognition. For example: + + * `en-US` for American English + * `fr-FR` for French + +* **[`AllowInterimResults`](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Inputs.SfSpeechToText.html#Syncfusion_Blazor_Inputs_SfSpeechToText_AllowInterimResults)**: Set to `true` to receive real-time (interim) recognition results, or `false` to receive only final results. + +The `speechtotext.js` file handles operations related to the content of the editable footer, such as checking for meaningful input, clearing existing text, and updating the content with the transcribed value. Meanwhile, the `speechtotext.css` file styles the Chat UI layout and ensures the component remains responsive across different screen sizes and devices. + +{% tabs %} +{% highlight c# tabtitle="razor" %} + +@using Syncfusion.Blazor.InteractiveChat +@using Syncfusion.Blazor.Buttons +@using Syncfusion.Blazor.Inputs +@inject IJSRuntime JSRuntime + +
    + + + + + +
    +@code { + private SfChatUI chatUI; + private static UserModel CurrentUserModel = new UserModel() { ID = "User1", User = "Albert" }; + private static UserModel MichaleUserModel = new UserModel() { ID = "User2", User = "Michale Suyama" }; + private string ChatUIFooterValue = String.Empty; + private ElementReference EditableDiv; + private string FooterContent = String.Empty; + private string SpeechToTextCssClass = "visible"; + private string ButtonCssClass = String.Empty; + private bool DisabledState = false; + + private List ChatUserMessages = new List() + { + new ChatMessage() { Text = "Hi Michale, are we on track for the deadline?", Author = CurrentUserModel }, + new ChatMessage() { Text = "Yes, the design phase is complete.", Author = MichaleUserModel }, + new ChatMessage() { Text = "I’ll review it and send feedback by today.", Author = CurrentUserModel } + }; + + private async void OnTranscriptChange(TranscriptChangeEventArgs args) + { + ChatUIFooterValue = args.Transcript; + await JSRuntime.InvokeVoidAsync("updateContentEditableDiv", EditableDiv, ChatUIFooterValue); + await InvokeAsync(StateHasChanged); + } + private async Task UpdateContent() + { + FooterContent = await JSRuntime.InvokeAsync("isFooterContainsValue", EditableDiv); + ToggleVisibility(); + } + private async Task HandleStopRecognition() + { + FooterContent = ChatUIFooterValue; + ToggleVisibility(); + await InvokeAsync(StateHasChanged); + } + private void ToggleVisibility() + { + ButtonCssClass = string.IsNullOrWhiteSpace(FooterContent) ? "" : "visible"; + SpeechToTextCssClass = string.IsNullOrWhiteSpace(FooterContent) ? "visible" : ""; + } + + private async Task SendButtonClicked() + { + chatUI.Messages.Add(new ChatMessage() { Text = FooterContent, Author = CurrentUserModel }); + ChatUIFooterValue = String.Empty; + await JSRuntime.InvokeVoidAsync("emptyFooterValue", EditableDiv); + await UpdateContent(); + ToggleVisibility(); + } + private async Task OnKeyDown(KeyboardEventArgs e) + { + if (e.Key == "Enter" && !e.ShiftKey) + { + await SendButtonClicked(); + } + } +} + +{% endhighlight %} + +{% highlight c# tabtitle="speechtotext.js" %} + +// Checks if the content editable element contains meaningful text and cleans up. +function isFooterContainsValue(elementref) { + if (!elementref.innerText.trim() !== '') { + if ((elementref.innerHTML === '
    ' || elementref.innerHTML.trim() === '')) { + elementref.innerHTML = ''; + } + } + return elementref.innerText || ""; +} +// Clears the text content of a content editable element. +function emptyFooterValue(elementref) { + if (elementref) { + elementref.innerText = ""; + } +} +// Updates the text content of a content editable element with a specified value. +function updateContentEditableDiv(element, value) { + if (element) { + element.innerText = value; + } +} + +{% endhighlight %} + +{% highlight c# tabtitle="speechtotext.css" %} + +.integration-speechtotext { + height: 400px; + width: 450px; + margin: 0 auto; +} + +.integration-speechtotext #chatui-sendButton { + width: 40px; + height: 40px; + font-size: 15px; + border: none; + background: none; + cursor: pointer; +} + +.integration-speechtotext #speechToText.visible, +.integration-speechtotext #chatui-sendButton.visible { + display: inline-block; +} + +.integration-speechtotext #speechToText, +.integration-speechtotext #chatui-sendButton { + display: none; +} + +@@media only screen and (max-width: 750px) { + .integration-speechtotext { + width: 100%; + } +} + +.integration-speechtotext .e-footer-wrapper { + display: flex; + border: 1px solid #c1c1c1; + margin: 5px 5px 0 5px; + border-radius: 10px; + padding: 5px; +} + +.integration-speechtotext .content-editor { + width: 100%; + overflow-y: auto; + font-size: 14px; + min-height: 20px; + max-height: 150px; + padding: 10px; +} + +.integration-speechtotext .content-editor[contentEditable='true']:empty:before { + content: attr(placeholder); + color: #6b7280; + font-style: italic; +} + +.integration-speechtotext .option-container { + align-self: flex-end; +} + +{% endhighlight %} + +{% endtabs %} + +![Integrating Speech-to-Text with Chat UI](./images/chatui-stt.png) + +## Error Handling + +The `SpeechToText` component provides events to handle errors that may occur during speech recognition. For more information, refer to the [Error Handling](https://blazor.syncfusion.com/documentation/speech-to-text/speech-recognition#error-handling) section in the documentation. + +## Browser Compatibility + +The `SpeechToText` component relies on the [Speech Recognition API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition), which has limited browser support. Refer to the [Browser Compatibility](https://blazor.syncfusion.com/documentation/speech-to-text/speech-recognition#browser-support) section for detailed information. + +## See Also + +* [Messages](./messages) diff --git a/blazor/file-upload/form-integration.md b/blazor/file-upload/form-integration.md new file mode 100644 index 0000000000..2ac48e0719 --- /dev/null +++ b/blazor/file-upload/form-integration.md @@ -0,0 +1,155 @@ +--- +layout: post +title: Form Integration in Blazor File Upload Component | Syncfusion +description: Learn how to integrate the Syncfusion Blazor File Upload component with Blazor's EditForm and DataForm for seamless form-based file management. +platform: Blazor +control: File Upload +documentation: ug +--- + +# Form Integration in Blazor File Upload Component + +The Syncfusion Blazor File Upload component seamlessly integrates with Blazor's [EditForm](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/?view=aspnetcore-9.0) and the Syncfusion [DataForm](https://blazor.syncfusion.com/documentation/data-form/getting-started-with-web-app), enabling you to build robust forms with file upload functionality. This integration associates the uploaded file information with a data model, leveraging the form's built-in validation. + +When a file is selected, its information is added to the model property bound to the component. Upon form submission, the entire model, including the list of selected files, is passed to the submit event handler. + +## File Upload with EditForm Integration + +Integrating the File Upload component into a Blazor `EditForm` streamlines data entry by including file management directly within the form. + +Validation for the file input is achieved by binding the component to a model property. The [ValueChange](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Inputs.UploaderEvents.html#Syncfusion_Blazor_Inputs_UploaderEvents_ValueChange) and [OnRemove](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Inputs.UploaderEvents.html#Syncfusion_Blazor_Inputs_UploaderEvents_OnRemove) events are used to update this property with the current list of files. Within these events, it is crucial to call `EditContext.NotifyFieldChanged` to trigger the form's validation logic immediately after the file list changes. + +When the form is successfully submitted, the `OnValidSubmit` event handler receives the `EditContext`, which contains the complete form model. + +```cshtml +@using System.ComponentModel.DataAnnotations +@using Syncfusion.Blazor.Inputs +@using Syncfusion.Blazor.Buttons + + + +
    + + + + +
    + Submit +
    + +@code { + public class UserDataModel + { + [MinLength(1, ErrorMessage = "Please upload a file")] + public List files { get; set; } = new(); + } + + public UserDataModel employee = new UserDataModel(); + private SfUploader UploaderObj; + + private async Task OnChange(UploadChangeEventArgs args, EditContext context) + { + employee.files = await UploaderObj.GetFilesDataAsync(); + context?.NotifyFieldChanged(FieldIdentifier.Create(() => employee.files)); + } + + private async Task OnRemove(RemovingEventArgs args, EditContext context) + { + var currentFiles = await UploaderObj.GetFilesDataAsync(); + var fileToRemove = args.FilesData.FirstOrDefault(); + if (fileToRemove != null) + { + currentFiles = currentFiles.Where(f => f.Name != fileToRemove.Name).ToList(); + } + employee.files = currentFiles; + context?.NotifyFieldChanged(FieldIdentifier.Create(() => employee.files)); + } + + public void HandleValidSubmit(EditContext args) + { + // The form model (args.Model) now contains the list of selected files. + // The 'employee.files' property holds the FileInfo objects. + // From here, you can implement custom logic to upload the files to a server, + // for example, by iterating through the list and using HttpClient. + var filesToUpload = employee.files; + // Custom file upload logic goes here. + } +} +``` + +{% previewsample "https://blazorplayground.syncfusion.com/embed/rXroWjZwIzUqaemW?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %} + +![Blazor File Upload component within an EditForm, showing validation and submission.](./images/blazor-uploader-editform.gif) + +## File Upload with DataForm Integration + +The File Upload component can also be integrated into a Syncfusion `DataForm` to automatically build a form from a model that includes file upload capabilities. + +When the `DataForm` is submitted, the [OnSubmit](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataForm.SfDataForm.html#Syncfusion_Blazor_DataForm_SfDataForm_OnSubmit) event handler receives the `EditContext`. The `EditContext.Model` property contains the complete form data, including the list of `FileInfo` objects from the File Upload component. This allows you to access and process the file information as part of the form's submission logic. + + +```cshtml +@using Syncfusion.Blazor.DataForm +@using System.ComponentModel.DataAnnotations +@using Syncfusion.Blazor.Inputs + + + + + + + + + + + + +@code { + public class UserDataModel + { + [MinLength(1, ErrorMessage = "Please upload a file")] + public List files { get; set; } = new(); + } + + private UserDataModel UserModel = new UserDataModel(); + private SfDataForm DataForm; + private SfUploader UploaderObj; + + private async Task OnChange(UploadChangeEventArgs args) + { + this.UserModel.files = await UploaderObj.GetFilesDataAsync(); + var fieldIdentifier = FieldIdentifier.Create(() => UserModel.files); + DataForm.EditContext?.NotifyFieldChanged(fieldIdentifier); + } + + private async Task OnRemove(RemovingEventArgs args) + { + var currentFiles = await UploaderObj.GetFilesDataAsync(); + var fileToRemove = args.FilesData.FirstOrDefault(); + if (fileToRemove != null) + { + currentFiles = currentFiles.Where(f => f.Name != fileToRemove.Name).ToList(); + } + this.UserModel.files = currentFiles; ; + var fieldIdentifier = FieldIdentifier.Create(() => UserModel.files); + DataForm.EditContext?.NotifyFieldChanged(fieldIdentifier); + } + + private void Submit(EditContext args) + { + // The form model is available in args.Model. + // The 'files' property contains the list of selected FileInfo objects. + // Custom file upload logic can be implemented here. + var modelWithFileData = (UserDataModel)args.Model; + var filesToUpload = modelWithFileData.files; + } +} +``` + +{% previewsample "https://blazorplayground.syncfusion.com/embed/LZheWNXGeJtxWIXQ?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %} + +![Blazor File Upload component within a Syncfusion DataForm.](./images/blazor-uploader-dataform.gif) diff --git a/blazor/file-upload/images/blazor-uploader-dataform.gif b/blazor/file-upload/images/blazor-uploader-dataform.gif new file mode 100644 index 0000000000..fa7228ad31 Binary files /dev/null and b/blazor/file-upload/images/blazor-uploader-dataform.gif differ diff --git a/blazor/file-upload/images/blazor-uploader-editform.gif b/blazor/file-upload/images/blazor-uploader-editform.gif new file mode 100644 index 0000000000..20870c4e1a Binary files /dev/null and b/blazor/file-upload/images/blazor-uploader-editform.gif differ diff --git a/blazor/gantt-chart/filter-menu.md b/blazor/gantt-chart/filter-menu.md new file mode 100644 index 0000000000..6c43420cf0 --- /dev/null +++ b/blazor/gantt-chart/filter-menu.md @@ -0,0 +1,284 @@ +--- +layout: post +title: Filter in Blazor Gantt Chart | Syncfusion +description: Checkout and learn here all about how to use an Excel like filter in the Syncfusion Blazor Gantt Chart and much more details. Explore to more details. +platform: Blazor +control: Gantt Chart +documentation: ug +--- + +# Filter menu in Blazor Gantt Chart component + +The Syncfusion Blazor Gantt Chart component provides a filter menu for each column, allowing filtering based on data type and supported operators. + +To enable this feature, configure [GanttFilterSettings.FilterType](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttFilterSettings.html#Syncfusion_Blazor_Gantt_GanttFilterSettings_FilterType) as **Menu** and set [AllowFiltering](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_AllowFiltering) to **true**. + +## Custom component in filter menu + +You can customize the filter menu in the Syncfusion® Blazor Gantt Chart component using the [FilterTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttColumn.html#Syncfusion_Blazor_Gantt_GanttColumn_FilterItemTemplate) property. This allows you to replace the default filter controls with custom components such as dropdowns or textboxes for specific columns. By default, the Gantt Chart uses Autocomplete for string columns, NumericTextBox for number columns, DatePicker for date columns, and DropDownList for boolean column. + +Here is a sample code demonstrating how to render a [DropDownList](https://blazor.syncfusion.com/documentation/dropdown-list/getting-started-with-web-app) for the **TaskName** column: + +{% tabs %} +{% highlight razor tabtitle="Index.razor" %} + +@using Syncfusion.Blazor.Gantt +@using Syncfusion.Blazor.DropDowns + + + + + + + + + + + @{ + var contextModel = context as PredicateModel; + } + + + + + + + + + + +@code { + private List TaskCollection { get; set; } = new(); + + protected override void OnInitialized() + { + TaskCollection = GetTaskCollection(); + } + + private static List GetTaskCollection() + { + List Tasks = new List() + { + new TaskData() { TaskID = 1, TaskName = "Project initiation", StartDate = new DateTime(2022, 01, 04), EndDate = new DateTime(2022, 01, 7), }, + new TaskData() { TaskID = 2, TaskName = "Identify Site location", StartDate = new DateTime(2022, 01, 04), Duration = "0", Progress = 30, ParentID = 1, }, + new TaskData() { TaskID = 3, TaskName = "Perform soil test", StartDate = new DateTime(2022, 01, 04), Duration = "4", Progress = 40, ParentID = 1, }, + new TaskData() { TaskID = 4, TaskName = "Soil test approval", StartDate = new DateTime(2022, 01, 04), Duration = "0", Progress = 30, ParentID = 1, }, + new TaskData() { TaskID = 5, TaskName = "Project estimation", StartDate = new DateTime(2022, 01, 04), EndDate = new DateTime(2022, 01, 10), }, + new TaskData() { TaskID = 6, TaskName = "Develop floor plan for estimation", StartDate = new DateTime(2022, 01, 06), Duration = "3", Progress = 30, ParentID = 5, }, + new TaskData() { TaskID = 7, TaskName = "List materials", StartDate = new DateTime(2022, 01, 06), Duration = "3", Progress = 40, ParentID = 5, }, + new TaskData() { TaskID = 8, TaskName = "Estimation approval", StartDate = new DateTime(2022, 01, 06), Duration = "0", Progress = 30, ParentID = 5, } + }; + return Tasks; + } + + public class TaskData + { + public int TaskID { get; set; } + public string TaskName { get; set; } + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public string Duration { get; set; } + public int Progress { get; set; } + public int? ParentID { get; set; } + } +} + +{% endhighlight %} +{% endtabs %} + +{% previewsample "https://blazorplayground.syncfusion.com/embed/BDBeCjZUpcIouXer?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %} + +## Hide default filter icon while perform filtering through method + +To remove the default filter icon from the UI, apply the following CSS: + +```css +.e-filtermenudiv.e-icons.e-icon-filter { + display: none; +} + +``` + +You can perform filtering programmatically using the [FilterByColumnAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_FilterByColumnAsync_System_String_System_String_System_String_System_String_System_Nullable_System_Boolean__System_Nullable_System_Boolean__) method, and reset it using [ClearFilteringAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_ClearFilteringAsync) through button actions. + +{% tabs %} +{% highlight razor tabtitle="Index.razor" %} + +@using Syncfusion.Blazor.Gantt +@using Syncfusion.Blazor.Buttons + +
    + Filter Task Name Column + Clear Filter +
    + + + + + + + + + + + + + + +@code { + private List TaskCollection { get; set; } = new(); + private SfGantt GanttInstance; + + protected override void OnInitialized() + { + TaskCollection = GetTaskCollection(); + } + + private async Task PerformFilter() + { + await GanttInstance.FilterByColumnAsync("TaskName", "startswith", "Project"); + } + + private async Task ClearFilter() + { + await GanttInstance.ClearFilteringAsync(); + } + + private static List GetTaskCollection() + { + List Tasks = new List() + { + new TaskData() { TaskID = 1, TaskName = "Project initiation", StartDate = new DateTime(2022, 01, 04), EndDate = new DateTime(2022, 01, 7), }, + new TaskData() { TaskID = 2, TaskName = "Identify Site location", StartDate = new DateTime(2022, 01, 04), Duration = "0", Progress = 30, ParentID = 1, }, + new TaskData() { TaskID = 3, TaskName = "Perform soil test", StartDate = new DateTime(2022, 01, 04), Duration = "4", Progress = 40, ParentID = 1, }, + new TaskData() { TaskID = 4, TaskName = "Soil test approval", StartDate = new DateTime(2022, 01, 04), Duration = "0", Progress = 30, ParentID = 1, }, + new TaskData() { TaskID = 5, TaskName = "Project estimation", StartDate = new DateTime(2022, 01, 04), EndDate = new DateTime(2022, 01, 10), }, + new TaskData() { TaskID = 6, TaskName = "Develop floor plan for estimation", StartDate = new DateTime(2022, 01, 06), Duration = "3", Progress = 30, ParentID = 5, }, + new TaskData() { TaskID = 7, TaskName = "List materials", StartDate = new DateTime(2022, 01, 06), Duration = "3", Progress = 40, ParentID = 5, }, + new TaskData() { TaskID = 8, TaskName = "Estimation approval", StartDate = new DateTime(2022, 01, 06), Duration = "0", Progress = 30, ParentID = 5, } + }; + return Tasks; + } + + public class TaskData + { + public int TaskID { get; set; } + public string TaskName { get; set; } + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public string Duration { get; set; } + public int Progress { get; set; } + public int? ParentID { get; set; } + } +} + +{% endhighlight %} +{% endtabs %} + +{% previewsample "https://blazorplayground.syncfusion.com/embed/BNrysXXUTPPCTyhw?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %} + +## Customize the default input component of filter menu dialog + +You can customize the input components in the filter menu of the Syncfusion Blazor Gantt Chart by using the [FilterTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttColumn.html#Syncfusion_Blazor_Gantt_GanttColumn_FilterItemTemplate) property in `GanttColumn`. This enables column-specific customization and precise control over the behavior of individual filter components. + +| Column Type | Default component |Customization | API Reference | +| ----------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| String | [AutoComplete](https://blazor.syncfusion.com/documentation/autocomplete/getting-started) | Eg: Autofill="false" | [AutoComplete API](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.SfAutoComplete-2.html) | +| Number | [NumericTextBox](https://blazor.syncfusion.com/documentation/numeric-textbox/getting-started) | Eg: ShowSpinButton="false" | [NumericTextBox API](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Inputs.SfNumericTextBox-1.html) | +| Boolean | [DropDownList](https://blazor.syncfusion.com/documentation/dropdown-list/getting-started) | Eg: SortOrder="SortOrder.Ascending" | [DropDownList API](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.SfDropDownList-2.html) | +| Date | [DatePicker](https://blazor.syncfusion.com/documentation/datepicker/getting-started) | Eg: WeekNumber="true" | [DatePicker API](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Calendars.SfDatePicker-1.html) | +| DateTime | [DateTimePicker](https://blazor.syncfusion.com/documentation/datetime-picker/getting-started) | Eg: ShowClearButton="true" | [DateTimePicker API](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Calendars.SfDateTimePicker-1.html) | + +The following sample demonstrates how to disable the autofill feature by setting the `Autofill` parameter to **false** for the **TaskName** column, and how to configure a `NumericTextBox` without a spin button (`ShowSpinButton` set to **false**) for the **TaskID** column. + +{% tabs %} +{% highlight razor tabtitle="Index.razor" %} + +@using Syncfusion.Blazor.Gantt +@using Syncfusion.Blazor.Inputs +@using Syncfusion.Blazor.DropDowns +@using Syncfusion.Blazor.Grids + + + + + + + + + + + @{ + var contextModel = context as PredicateModel; + } + + + + + + + @{ + var contextModel = context as PredicateModel; + } + + + + + + + + + + + +@code { + private List TaskCollection { get; set; } = new(); + private List CustomerData { get; set; } = new(); + + protected override void OnInitialized() + { + TaskCollection = GetTaskCollection(); + CustomerData = TaskCollection.Select(t => t.TaskName).Distinct().ToList(); + } + + private static List GetTaskCollection() + { + List Tasks = new List() + { + new TaskData() { TaskID = 1, TaskName = "Project initiation", StartDate = new DateTime(2022, 01, 04), EndDate = new DateTime(2022, 01, 7), }, + new TaskData() { TaskID = 2, TaskName = "Identify Site location", StartDate = new DateTime(2022, 01, 04), Duration = "0", Progress = 30, ParentID = 1, }, + new TaskData() { TaskID = 3, TaskName = "Perform soil test", StartDate = new DateTime(2022, 01, 04), Duration = "4", Progress = 40, ParentID = 1, }, + new TaskData() { TaskID = 4, TaskName = "Soil test approval", StartDate = new DateTime(2022, 01, 04), Duration = "0", Progress = 30, ParentID = 1, }, + new TaskData() { TaskID = 5, TaskName = "Project estimation", StartDate = new DateTime(2022, 01, 04), EndDate = new DateTime(2022, 01, 10), }, + new TaskData() { TaskID = 6, TaskName = "Develop floor plan for estimation", StartDate = new DateTime(2022, 01, 06), Duration = "3", Progress = 30, ParentID = 5, }, + new TaskData() { TaskID = 7, TaskName = "List materials", StartDate = new DateTime(2022, 01, 06), Duration = "3", Progress = 40, ParentID = 5, }, + new TaskData() { TaskID = 8, TaskName = "Estimation approval", StartDate = new DateTime(2022, 01, 06), Duration = "0", Progress = 30, ParentID = 5, } + }; + return Tasks; + } + + public class TaskData + { + public int TaskID { get; set; } + public string TaskName { get; set; } + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public string Duration { get; set; } + public int Progress { get; set; } + public int? ParentID { get; set; } + } +} + +{% endhighlight %} +{% endtabs %} + +{% previewsample "https://blazorplayground.syncfusion.com/embed/BZhosZjKTkWPUTuQ?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %} + diff --git a/blazor/gantt-chart/split-task.md b/blazor/gantt-chart/splitting-and-merging-tasks.md similarity index 89% rename from blazor/gantt-chart/split-task.md rename to blazor/gantt-chart/splitting-and-merging-tasks.md index be7d165faf..a59bf4e4c4 100644 --- a/blazor/gantt-chart/split-task.md +++ b/blazor/gantt-chart/splitting-and-merging-tasks.md @@ -1,23 +1,27 @@ --- layout: post -title: Split task in Blazor Gantt Chart component | Syncfusion -description: Checkout and learn here all about split task in Syncfusion Blazor Gantt Chart component and much more. +title: Splitting and merging tasks in Syncfusion Blazor Gantt Chart component +description: Learn how to split and merge tasks in the Syncfusion Blazor Gantt Chart component for flexible task management in project timelines. platform: Blazor -control: Gantt Chart +control: Splitting and merging tasks documentation: ug --- -# Split task in Blazor Gantt Chart component +# Splitting and merging tasks in Blazor Gantt Chart component -In [Blazor Gantt Chart](https://www.syncfusion.com/blazor-components/blazor-gantt-chart), the split task feature enables you to divide a task or pause work when necessary, whether it's planned or unexpected. This feature adds dynamism and interactivity to the view, enhancing the visualization of project tasks on the timeline. The divided parts of a task's bar in the Gantt Chart are referred to as **segments**. You have the flexibility to both split and merge multiple segments within a taskbar. +Splitting and merging tasks in the Blazor Gantt Chart component enhances project management by allowing tasks to be divided into segments or recombined, representing breaks or continuous work periods. This feature enables dividing a task or pausing work when necessary, whether planned or unexpected, and adds dynamism to the timeline view for better visualization. -![Split task](images/blazor-gantt-chart-split-task.png) +The divided parts of a taskbar are referred to as **segments**. Tasks can be split at load time using [GanttSegmentFields](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html), ensuring segments fit within the task's start and end dates. Dynamic splitting is supported via the dialog's Segments tab or the context menu's Split Task option, which requires valid [GanttTaskFields](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html) mappings. + +Merging can be done using the context menu's Merge Task option or by dragging segments together in the UI. To enable these actions, set the [EnableContextMenu](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_EnableContextMenu) property to **true**. Tasks must have sufficient width relative to the timeline unit and must not be parent or milestone tasks. Avoid using split tasks with multi-taskbar features to maintain compatibility. ## Binding segments data source -In the Blazor Gantt chart, the [GanttSegmentFields](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html) component plays a vital role in managing segmented tasks. The [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html#Syncfusion_Blazor_Gantt_GanttSegmentFields_2_DataSource) property of `GanttSegmentFields` determines the segment data source collection. It is essential that this collection be structured in such a way that the [ForeignKey](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html#Syncfusion_Blazor_Gantt_GanttSegmentFields_2_ForeignKey) property of `GanttSegmentFields` and the [ID](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html#Syncfusion_Blazor_Gantt_GanttTaskFields_Id) property value of [GanttTaskFields](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html) act as a foreign key relationship between the task collection [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_DataSource) and the segment collection `DataSource`. Additionally, the start date, end date, and duration field mappings of the segment collection can be defined in `GanttSegmentFields`. +In the Blazor Gantt Chart, the [GanttSegmentFields](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html) component plays a vital role in managing segmented tasks. The [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html#Syncfusion_Blazor_Gantt_GanttSegmentFields_2_DataSource) property of `GanttSegmentFields` defines the segment data source collection. +This collection must be structured so that the [ForeignKey](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html#Syncfusion_Blazor_Gantt_GanttSegmentFields_2_ForeignKey) property of `GanttSegmentFields` and the [Id](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html#Syncfusion_Blazor_Gantt_GanttTaskFields_Id) property of [GanttTaskFields](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTaskFields.html) form a foreign key relationship between the task collection `DataSource` and the segment collection `DataSource`. +Additionally, the start date, end date, and duration field mappings of the segment collection can be defined using the corresponding properties in `GanttSegmentFields`. -The below code snippet visualizes the task's segments in gantt chart. +The following code snippet demonstrates how to visualize task segments in the Gantt Chart. {% tabs %} {% highlight razor tabtitle="Index.razor" %} @@ -118,15 +122,15 @@ The below code snippet visualizes the task's segments in gantt chart. ## Split and merge tasks dynamically -In the Gantt Chart, you can enable dynamic splitting or merging of segments by setting the [AllowTaskbarEditing](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttEditSettings.html#Syncfusion_Blazor_Gantt_GanttEditSettings_AllowTaskbarEditing) and [AllowEditing](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttEditSettings.html#Syncfusion_Blazor_Gantt_GanttEditSettings_AllowEditing) properties to true in the [GanttEditSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttEditSettings.html) component. Tasks or segments can be dynamically split into multiple segments, and also the existing segments can be merged together. Segments can be merged by simply dragging a segment of taskbar and dropping it over another segment of same task. Additionally, the split and merge actions can be performed in the Gantt Chart in the following three ways: +In the Gantt Chart, dynamic splitting and merging of segments can be enabled by setting the [AllowTaskbarEditing](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttEditSettings.html#Syncfusion_Blazor_Gantt_GanttEditSettings_AllowTaskbarEditing) and [AllowEditing](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttEditSettings.html#Syncfusion_Blazor_Gantt_GanttEditSettings_AllowEditing) properties to true in the [GanttEditSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttEditSettings.html) component. Tasks or segments can be dynamically split into multiple segments, and existing segments can be merged. Merging can be performed by dragging a segment and dropping it over another segment of the same task. Additionally, split and merge actions can be performed in the Gantt Chart using the following three methods: ### Through context menu -To split and merge tasks using the context menu, set the [EnableContextMenu](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_EnableContextMenu) property to true in the `SfGantt` component. By using the context menu items, such as **Split Task** and **Merge Task** the taskbar can be split and merged respectively. +To split and merge tasks using the context menu, set the [EnableContextMenu](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_EnableContextMenu) property to **true** in the `SfGantt` component. Once enabled, context menu items such as **Split Task** and **Merge Task** allow taskbars to be split and merged directly from the UI. + +Right-clicking on a taskbar or segment element in the Gantt Chart displays the context menu with the **Split Task** option. Selecting this option divides the taskbar or segment at the timeline cell where the right-click occurred. -When you right-click on a taskbar or segment element in the Gantt chart, the context menu will display the **Split Task** option. Clicking on it will divide the taskbar or segment at the timeline cell where the right-click occurred. - -The segmented taskbars can be merged together using **Merge Task** context menu item. The sub context menu of **Merge Task** item includes options for **Right** and **Left**. When the **Right** submenu item is selected, the current segment and the segment to the right of the selected segment gets merged. Similarly, when the **Left** submenu item is selected, the current segment and the segment to the left of the selected segment gets merged. +Segmented taskbars can be merged using the **Merge Task** context menu item. Its sub-menu includes **Right** and **Left** options. Selecting **Right** merges the current segment with the one to its right, while selecting **Left** merges it with the segment to its left. {% tabs %} {% highlight razor tabtitle="Index.razor" %} @@ -228,7 +232,7 @@ The segmented taskbars can be merged together using **Merge Task** context menu ### Through dialog box -In the segments tab of the [add/edit dialog](https://blazor.syncfusion.com/documentation/gantt-chart/editing-tasks#dialog-editing), taskbars can be split or merged by providing the segments details such as the start date, end date, and duration. However, it's important to note that the segment start date and end date cannot exceed the task's start date and end date. +In the segments tab of the [add/edit dialog](https://blazor.syncfusion.com/documentation/gantt-chart/editing-tasks#dialog-editing), taskbars can be split or merged by providing segments details such as the start date, end date, and duration. However, It is important to note that a segment's start and end dates must fall within the task's overall start and end dates.. {% tabs %} {% highlight razor tabtitle="Index.razor" %} @@ -335,9 +339,9 @@ In the segments tab of the [add/edit dialog](https://blazor.syncfusion.com/docum ### Through method -You can split or merge taskbars externally by using the methods [SplitTaskAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_SplitTaskAsync_System_Int32_System_Collections_Generic_List_System_DateTime__) and [MergeTaskAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_MergeTaskAsync_System_Int32_System_Collections_Generic_List_System_ValueTuple_System_Int32_System_Int32___) respectively. These methods provide a way to manipulate taskbars programmatically, allowing for efficient splitting and merging operations. +Taskbars can be split or merged externally using the [SplitTaskAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_SplitTaskAsync_System_Int32_System_Collections_Generic_List_System_DateTime__) and [MergeTaskAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SfGantt-1.html#Syncfusion_Blazor_Gantt_SfGantt_1_MergeTaskAsync_System_Int32_System_Collections_Generic_List_System_ValueTuple_System_Int32_System_Int32___) methods. These provide a programmatic way to perform efficient splitting and merging operations on taskbars. -In the following code snippet, upon external button click, segments of the 1st index record are merged into a single taskbar, and the taskbar in the 2nd index record is split into two segments. +In the following code snippet, clicking an external button merges the segments of the taskbar at index 1 into a single segment and splits the taskbar at index 2 into two segments. {% tabs %} {% highlight razor tabtitle="Index.razor" %} @@ -455,8 +459,6 @@ In the following code snippet, upon external button click, segments of the 1st i {% previewsample "https://blazorplayground.syncfusion.com/embed/BXresXZYqLhJtdVC?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" %} -![Editing split task using method](images/blazor-gantt-chart-split-task-method.gif) - ## Segment event The [SegmentChanging](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttSegmentFields-2.html#Syncfusion_Blazor_Gantt_GanttSegmentFields_2_SegmentChanging) event is triggered in the Blazor Gantt chart when split and merge actions occur, or when there are changes in the scheduling dates of tasks. Using this event, any custom actions can be performed or even the split or merge action can be canceled by setting the [Cancel](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.SegmentEventArgs-1.html#Syncfusion_Blazor_Gantt_SegmentEventArgs_1_Cancel) property of the even argument to `true`. @@ -590,7 +592,7 @@ In the below code snippet, using the `SegmentChanging` event a customized messag ## Segment customization with template -The segments appearance can be customized by using the [TaskbarTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTemplates-1.html#Syncfusion_Blazor_Gantt_GanttTemplates_1_TaskbarTemplate) property. By passing the template context to the `GetRowTaskModel`, the collection of [Segments](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.IGanttTaskModel-1.html#Syncfusion_Blazor_Gantt_IGanttTaskModel_1_Segments) are obtained which holds the details like left position, width, and progress width for each segment. The segments can be rendered at the required timeline position and dimensions within the template container using these details. +In the Blazor Gantt Chart, the appearance of segments can be customized by using the [TaskbarTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.GanttTemplates-1.html#Syncfusion_Blazor_Gantt_GanttTemplates_1_TaskbarTemplate) property. By passing the template context to the `GetRowTaskModel`, the collection of [Segments](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Gantt.IGanttTaskModel-1.html#Syncfusion_Blazor_Gantt_IGanttTaskModel_1_Segments) is obtained, which contains details like left position, width, and progress width for each segment. The segments can be rendered at the appropriate timeline position and dimensions within the template container using these details. In the code snippet below, the segments are customized based on template context data, and the segment count text is added inside each segment. @@ -747,4 +749,11 @@ In the code snippet below, the segments are customized based on template context ## Limitation -* Parent and milestone tasks cannot be split into segments. \ No newline at end of file +1. Parent and milestone tasks cannot be split into segments. +2. The task must have a width greater than the timeline unit cell in order to be split. +3. Split task is not supported with `Multi taskbar`. + +## See also +- [How to bind data in Gantt?](https://blazor.syncfusion.com/documentation/gantt-chart/data-binding) +- [How to configure task editing?](https://blazor.syncfusion.com/documentation/gantt-chart/editing-tasks) +- [How to manage task dependencies?](https://blazor.syncfusion.com/documentation/gantt-chart/task-dependencies) diff --git a/blazor/visual-studio-code-integration/upgrade-project.md b/blazor/visual-studio-code-integration/upgrade-project.md index b081715e76..70af54c052 100644 --- a/blazor/visual-studio-code-integration/upgrade-project.md +++ b/blazor/visual-studio-code-integration/upgrade-project.md @@ -1,36 +1,36 @@ --- layout: post -title: Upgrade a project to the latest version | Syncfusion -description: Learn here about how to upgrade the project to the latest version using the Syncfusion Blazor extension for Visual Studio Code. Explore to more details +title: Upgrade Project to Latest Version in Blazor | Syncfusion +description: Learn here about how to upgrade the project to the latest version using the Syncfusion Blazor extension for Visual Studio Code. Explore to more details. platform: Blazor -control: Common +component: Common documentation: ug --- -# Upgrading Syncfusion® Blazor application +# Upgrading Syncfusion® Blazor application to updated version -The Syncfusion® Blazor migration add-in for Visual Studio Code enables upgrading an existing Syncfusion® Blazor web application from one Essential Studio® version to another. +The Syncfusion® Blazor Migration is an add-in for Visual Studio Code allows you to migrate an existing Syncfusion® Blazor Web Application from one Essential Studio® version to another. -N> The Syncfusion Blazor Web Application project migration utility is available from version `v17.4.0.39`. + N> The Syncfusion® Blazor Web Application Project Migration utility is available from `v17.4.0.39`. -Use the following steps to migrate an existing Syncfusion® Blazor Web Application. +The steps below assist you to migrating existing Syncfusion® Blazor Web Application. -1. In Visual Studio Code, open an existing Syncfusion® Blazor Web Application or create a new one. +1. Open an existing Syncfusion® Blazor Web Application or create a new Syncfusion® Blazor Web Application in Visual Studio Code. -2. In Explorer (Workspace), right-click the project file and select **Migrate Syncfusion® Blazor Application to another version...** from the context menu. Refer to the screenshot below. +2. Select **Migrate Syncfusion® Blazor Application to another version...** from the context menu when you right-click on the **Project file** from Explorer (Workspace). Refer to the screenshot below. - ![Context menu showing Migrate Syncfusion Blazor Application command](images/Migration.PNG) + ![Migration add-in](images/Migration.PNG) - N> The Migration option is available only when the application already references Syncfusion® Blazor packages. + N> If you have a Syncfusion® Blazor reference in your application, the Migration option will be enabled. -3. From the Command Palette, choose **Select Blazor Version** and pick the required Syncfusion® Blazor package version published on `nuget.org`. +3. **Select Blazor Version** (which published in `nuget.org`) from the palette appears. - ![Palette showing selection of Syncfusion Blazor version](images/VersionSelection.PNG) + ![Select Blazor Version](images/VersionSelection.PNG) -4. The Syncfusion® Blazor NuGet package references and theme links are updated to the selected version in the application. +4. The Syncfusion® NuGet packages references and themes are updated to the selected version in the application. - ![Project file updated with new Syncfusion NuGet package versions](images/NuGetPackage.png) + ![NuGetPackage](images/NuGetPackage.png) - ![Theme link updated to the selected version](images/CDNLink.png) + ![CDNLink](images/CDNLink.png) 5. If you installed the trial setup or NuGet packages from nuget.org you must register the Syncfusion® license key to your application since Syncfusion® introduced the licensing system from 2018 Volume 2 (v16.2.0.41) Essential Studio® release. Navigate to the [help topic](https://help.syncfusion.com/common/essential-studio/licensing/overview#how-to-generate-syncfusion-license-key) to generate and register the Syncfusion® license key to your application. Refer to this [UG](https://blazor.syncfusion.com/documentation/getting-started/license-key/overview) topic for understanding the licensing details in Essential Studio® for Blazor. \ No newline at end of file