Hi,
I believe the Blazor Kanban control has been updated to allow adding columns dynamically at runtime? If this is possible, would you please be able to provide a sample demonstrating this?
Many thanks!
<button class="e-btn e-outline" @onclick="@addColumn">AddColumnbutton>
<br />
<SfKanban @ref="kanbanObj" KeyField="Status" DataSource="Tasks">
<KanbanColumns>
@foreach (ColumnModel item in columnData)
{
<KanbanColumn HeaderText="@item.HeaderText" KeyField="@item.KeyField" AllowToggle=true IsExpanded=true>
KanbanColumn>}
KanbanColumns>
<KanbanCardSettings ShowHeader=true HeaderField="Id" ContentField="Summary" SelectionType="@SelectionType.Multiple">KanbanCardSettings>
SfKanban> @code {
SfKanban<KanbanDataModel> kanbanObj;
private List<KanbanDataModel> Tasks = new KanbanDataModel().GetTasks();
private List<ColumnModel> columnData = new List<ColumnModel>()
{
new ColumnModel(){ HeaderText= "Backlog", KeyField= new List<string>(){"Open" } },
new ColumnModel(){ HeaderText= "In Progress", KeyField= new List<string>(){"InProgress" } },
new ColumnModel(){ HeaderText= "Testing", KeyField= new List<string>(){"Testing" } },
new ColumnModel(){ HeaderText= "Done", KeyField= new List<string>(){"Close" } }
}; public async Task addColumn()
{
await this.kanbanObj.AddColumnAsync(new ColumnModel() { HeaderText = "Review", KeyField = new List<string>() { "Review" } }, 1);
} } |
The provided code snippet above is full of typos and should be corrected. As well, formatting the code would make it much easier to read and understand.
<SfKanban KeyField="Status" DataSource="@Tasks"> <KanbanColumns> @foreach (ColumnModel item in columnData) { <KanbanColumn HeaderText="@item.HeaderText" KeyField="@item.KeyField" AllowAdding="true"></KanbanColumn> } </KanbanColumns> </SfKanban> private List<ColumnModel> columnData = new List<ColumnModel>() { .... ..... }; |