Kanban Customization

Hello

I read the documents of the site. Thank you for answering the following questions about the Kanban component.

1-In each column, when I change the order of the cards, it is not applied. I want the order to be preserved based on the user's changes.

The second thing is, based on which event, should I notice the order change in the columns and save the information in the database? Until next time, I will show the order of the user based on the latest changes.

2-I used the CardDoubleClick Event to display my dialog. After double clicking, syncfusion dialog will be displayed. How can I prevent the default dialog from showing?

3-How can I change the background color of each column?

4-How can I change the background color of the card?

5-How can I reduce the distance between the cards in the column?

6-How can I change the Kanban component font?

7-How to define context menu for cards?





8 Replies

VJ Vinitha Jeyakumar Syncfusion Team November 14, 2023 12:36 PM UTC

Hi Sarah,


Query 1. "In each column, when I change the order of the cards, it is not applied. I want the order to be preserved based on the user's changes"

We are quit unclear about your reported issue. So can you please share us with the more details about the issue for our better understanding.

Query 2. "The second thing is, based on which event, should I notice the order change in the columns and save the information in the database?"

Using ActionComplete event arguments, you can get the changed records while drag and drop between the columns in the Kanban.

Code snippet:
<SfKanban TValue="TasksModel" KeyField="Status" DataSource="Tasks">
    <KanbanColumns>
   .....
     ........
    </KanbanColumns>
    <KanbanEvents TValue="TasksModel" ActionComplete="ActionComplete"></KanbanEvents>
    <KanbanCardSettings HeaderField="Title" ContentField="Summary"></KanbanCardSettings>
</SfKanban>

@code {
  public void ActionComplete(Syncfusion.Blazor.Kanban.ActionEventArgs<TasksModel> args){
     
      }
}

Query 3. "I used the CardDoubleClick Event to display my dialog. After double clicking, syncfusion dialog will be displayed. How can I prevent the default dialog from showing?"

You can achieve your requirement by using the DialogOpen event argument Cancel. Please check the code below,

Code snippet:
<SfKanban TValue="TasksModel" KeyField="Status" DataSource="Tasks">
    
    <KanbanEvents TValue="TasksModel" DialogOpen="DialogOpen" ActionComplete="ActionComplete"></KanbanEvents>
    <KanbanCardSettings HeaderField="Title" ContentField="Summary"></KanbanCardSettings>
</SfKanban>

@code {
    public void DialogOpen(Syncfusion.Blazor.Kanban.DialogOpenEventArgs<TasksModel> args){
args.Cancel = true;
    }
}


Query 4. "How can I change the background color of each column"

You can achieve your requirement by customizing the CSS styles like below,

Code snippet:
<style>
    .e-kanban .e-kanban-table.e-content-table .e-content-row:not(.e-swimlane-row) td[data-key='Open'],

.e-kanban .e-kanban-table.e-header-table .e-header-row:not(.e-swimlane-row) th[data-key='Open'] {

  background-color: grey;

}

 

.e-kanban .e-kanban-table.e-content-table .e-content-row:not(.e-swimlane-row) td[data-key='InProgress'],

.e-kanban .e-kanban-table.e-header-table .e-header-row:not(.e-swimlane-row) th[data-key='InProgress'] {

  background-color: yellow;

}

.e-kanban .e-kanban-table.e-content-table .e-content-row:not(.e-swimlane-row) td[data-key='Testing'],

.e-kanban .e-kanban-table.e-header-table .e-header-row:not(.e-swimlane-row) th[data-key='Testing'] {

  background-color: red;

}

.e-kanban .e-kanban-table.e-content-table .e-content-row:not(.e-swimlane-row) td[data-key='Close'],

.e-kanban .e-kanban-table.e-header-table .e-header-row:not(.e-swimlane-row) th[data-key='Close'] {

  background-color: green;

}
</style>


Query 5. "How can I change the background color of the card?"

Your requirement to add unique background colors to the Kanban cards can be achieved by using the Card template, in which we can pass the required color to the card by getting it through datasource as like below,

Code snippet:
<KanbanCardSettings HeaderField="Id" ContentField="Summary">
        <Template>
            @{
                TasksModel data = (TasksModel)context;
                <div class="e-card-content" style="background-color:@data.Color">
                    <table class="card-template-wrap">
                        <tbody>
                            <tr>
                                <td class="CardHeader">Id:</td>
                                <td>@data.Id</td>
                            </tr>
                            <tr>
                                <td class="CardHeader">Type:</td>
                                <td>@data.Type</td>
                            </tr>
                            <tr>
                                <td class="CardHeader">Priority:</td>
                                <td>@data.Priority</td>
                            </tr>
                            <tr>
                                <td class="CardHeader">Summary:</td>
                                <td>@data.Summary</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            }
        </Template>
    </KanbanCardSettings>
public class TasksModel
    {
        public string Id { get; set; }
        public string Title { get; set; }
        public string Status { get; set; }
        public string Summary { get; set; }
        public string Type { get; set; }
        public string Priority { get; set; }
        public string Assignee { get; set; }
        public string Color { get; set; }
    }

    public List<TasksModel> Tasks = new List<TasksModel>()
    {
        new TasksModel { Id = "Task 1", Color = "red", Title = "BLAZ-29001", Status = "Open", Summary = "Analyze the new requirements gathered from the customer.", Assignee = "Nancy Davloio", Type = "Story", Priority = "Low" },
        new TasksModel { Id = "Task 2",Color = "blue", Title = "BLAZ-29002", Status = "InProgress", Summary = "Improve application performance", Assignee = "Andrew Fuller", Type = "Improvement", Priority = "Normal" },
        new TasksModel { Id = "Task 3",Color = "red", Title = "BLAZ-29003", Status = "Open", Summary = "Arrange a web meeting with the customer to get new requirements.", Assignee = "Janet Leverling", Type = "Others", Priority = "Critical" },
        new TasksModel { Id = "Task 4",Color = "blue", Title = "BLAZ-29004", Status = "InProgress", Summary = "Fix the issues reported in the IE browser.", Assignee = "Janet Leverling", Type = "Bug", Priority = "Release Breaker" },
        new TasksModel { Id = "Task 5",Color = "red", Title = "BLAZ-29005", Status = "Review", Summary = "Fix the issues reported by the customer.", Assignee = "Steven walker", Type = "Bug", Priority = "Low" },
        new TasksModel { Id = "Task 6",Color = "blue", Title = "BLAZ-29006", Status = "Review", Summary = "Fix the issues reported in Safari browser.", Assignee = "Nancy Davloio", Type = "Others", Priority = "Low" },
        new TasksModel { Id = "Task 7", Color = "red",Title = "BLAZ-29007", Status = "Close", Summary = "Test the application in the IE browser.", Assignee = "Margaret hamilt", Type = "Improvement", Priority = "Low" },
        new TasksModel { Id = "Task 8",Color = "blue", Title = "BLAZ-29008", Status = "Validate", Summary = "Validate the issues reported by the customer.", Assignee = "Steven walker", Type = "Story", Priority = "Release Breaker" },
        new TasksModel { Id = "Task 9", Color = "red",Title = "BLAZ-29009", Status = "Open", Summary = "Show the retrieved data from the server in grid control.", Assignee = "Margaret hamilt", Type = "Bug", Priority = "Release Breaker" },
}

Query 6. "How can I reduce the distance between the cards in the column"

You can achieve your requirement by customizing the CSS styles like below,

Code snippet:
<style>
.e-kanban .e-kanban-content .e-content-row .e-content-cells .e-card-container .e-card {
   
    margin-bottom: 5px !important;
    }
</style>



Query 7. "How can I change the Kanban component font?"

Code snippet:
<style> 
.e-kanban .e-kanban-content .e-content-row .e-content-cells .e-card-container .e-card .e-card-content {
    font-family: cursive ;
    }
    .e-kanban .e-kanban-table .e-header-cells .e-header-text {
    font-family: cursive;
    }

</style>



Query 8. "How to define context menu for cards?"

You can customize the default card layout using template as per your application needs. This can be achieved by template of the KanbanCardSettings property.


Regards,

Vinitha




SA Sarah replied to Vinitha Jeyakumar November 23, 2023 08:35 AM UTC

Hi Vinitha Jeyakumar,

Thank you for your reply


Query 1. "In each column, when I change the order of the cards, it is not applied. I want the order to be preserved based on the user's changes"

We are quit unclear about your reported issue. So can you please share us with the more details about the issue for our better understanding.



Image_3316_1700728314015


VJ Vinitha Jeyakumar Syncfusion Team November 24, 2023 12:18 PM UTC

Hi Sarah,


We have considered the reported issue "Couldn't drag and drop the cards within the same column in Kanban" as a bug from our end and the fix for the issue will be included with our upcoming patch release scheduled for the first week of December 2023.

Now you can track the status of the reported issue through the feedback below,

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”

Regards,
Vinitha



VJ Vinitha Jeyakumar Syncfusion Team December 7, 2023 09:59 AM UTC

Hi Sarah,


We are facing some complexities in fixing the reported issue. We will include the fix with our upcoming Vol 4 2023 release which is expected to be rolled out on the mid of December 2023.

Regards,
Vinitha




SA Sarah replied to Vinitha Jeyakumar December 25, 2023 01:36 PM UTC

Hi,

Thank you for your follow up .I used DragStop and ActionComplete events to determine which Kanban Card was dragged from which column to which column, but unfortunately I didn't get the result. Is it possible to help me? I use version 23.1.36.



VJ Vinitha Jeyakumar Syncfusion Team December 26, 2023 08:24 AM UTC

Hi Sarah,


On further validating the query "Couldn't drag and drop the cards within the same column in Kanban" , we found that in Blazor Platform sortSetting property default is DataSourceOrder. So add the Index property with Field Like below code snippet for Same column drag and drop.

 

For Reference Link : 
https://blazor.syncfusion.com/documentation/kanban/sort#index

 

<SfKanban TValue="TasksModel" KeyField="Status" DataSource="Tasks">

    <KanbanColumns>
        <KanbanColumn HeaderText="Backlog" KeyField="@(new List<string>() {"Open"})"></KanbanColumn>
        <KanbanColumn HeaderText="In Progress" KeyField="@(new List<string>() {"InProgress"})"></KanbanColumn>
        <KanbanColumn HeaderText="Testing" KeyField="@(new List<string>() {"Testing"})"></KanbanColumn>
        <KanbanColumn HeaderText="Done" KeyField="@(new List<string>() {"Close"})"></KanbanColumn>
    </KanbanColumns>
    <KanbanCardSettings HeaderField="Id" ContentField="Summary"></KanbanCardSettings>
    <KanbanSortSettings SortBy="SortOrderBy.Index" Field="Id1"></KanbanSortSettings>
</SfKanban>

@code {
    public class TasksModel
    {
        public string Id { get; set; }
        public string Title { get; set; }
        public string Status { get; set; }
        public string Summary { get; set; }
        public string Assignee { get; set; }
        public int Id1 { get; set; }
    }

    public List<TasksModel> Tasks = new List<TasksModel>()
{
        new TasksModel { Id = "Task 7",Id1 = 7, Title = "BLAZ-29007", Status = "Close", Summary = "Test the application in the IE browser.", Assignee = "Margaret hamilt" },

        new TasksModel { Id = "Task 8",Id1 = 8, Title = "BLAZ-29008", Status = "Validate", Summary = "Validate the issues reported by the customer.", Assignee = "Steven walker" },

        new TasksModel { Id = "Task 9",Id1 = 9, Title = "BLAZ-29009", Status = "Open", Summary = "Show the retrieved data from the server in grid control.", Assignee = "Margaret hamilt" },

        new TasksModel { Id = "Task 10",Id1 = 10, Title = "BLAZ-29010", Status = "InProgress", Summary = "Fix cannot open user’s default database SQL error.", Assignee = "Janet Leverling" },

         new TasksModel { Id = "Task 11",Id1 = 11, Title = "BLAZ-29007", Status = "Close", Summary = "Test the application in the IE browser.", Assignee = "Margaret hamilt" },

        new TasksModel { Id = "Task 12",Id1 = 12, Title = "BLAZ-29008", Status = "Validate", Summary = "Validate the issues reported by the customer.", Assignee = "Steven walker" },

        new TasksModel { Id = "Task 13",Id1 = 13, Title = "BLAZ-29009", Status = "Open", Summary = "Show the retrieved data from the server in grid control.", Assignee = "Margaret hamilt" },

        new TasksModel { Id = "Task 14",Id1 = 14, Title = "BLAZ-29010", Status = "InProgress", Summary = "Fix cannot open user’s default database SQL error.", Assignee = "Janet Leverling" },
    };
}

 

Query ".I used DragStop and ActionComplete events to determine which Kanban Card was dragged from which column to which column, but unfortunately I didn't get the result"


You can get the dragged column details of the Card using the DragStart event and the dropped column details using the DragStop event like below,


Code snippet:

<SfKanban TValue="TasksModel" KeyField="Status" DataSource="Tasks">
    <KanbanColumns>
      .....
    </KanbanColumns>
    <KanbanEvents TValue="TasksModel" DragStart="@DragStart" DragStop="@DragStop"></KanbanEvents>
    <KanbanCardSettings HeaderField="Id" ContentField="Summary"></KanbanCardSettings>
    <KanbanSortSettings SortBy="SortOrderBy.Index" Field="Id1"></KanbanSortSettings>
</SfKanban>

@code {
    public void DragStart(DragEventArgs<TasksModel> args)
    {
        Console.WriteLine("Drag started from", args.Data[0].Status);
    }
    public void DragStop(DragEventArgs<TasksModel> args)
    {
        Console.WriteLine("Drag stopped to", args.Data[0].Status);
    }




Regards,

Vinitha




SA Sarah February 17, 2024 01:53 PM UTC

Hello

Thank you for your reply

How can I reduce the height of the header??

Image_9575_1705503464474



VJ Vinitha Jeyakumar Syncfusion Team February 27, 2024 06:43 AM UTC

Hi Sarah,


Your requirement to customize the height of the Kanban header can be achieved by using the below CSS styles,


Code snippet:

<style>
    .e-kanban .e-header-row {
        height: 60px;
    }
</style>

Regards,
Vinitha

Loader.
Up arrow icon