Kanban loading data exeption

I am using Kanban tabel with 7 column every column is a day of the week so my keyfield is a date, and when I start to change the date with a datepicker I get an 

System.Collections.Generic.KeyNotFoundException: The given key '' was not present in the dictionary.

I don't know where is the problem in my code.


This is my columns.

The datasource of the kanban tabel is that KanbanData which is a: 

public IEnumerable<Cards> KanbanData { get; set; }


I don't know what kind of information do you need to understand perfectly my problem.

If you have any idea what can be my problem pls let me know.



5 Replies

VY Vinothkumar Yuvaraj Syncfusion Team July 24, 2023 03:27 PM UTC

Hi Nandor Kalmanchey,


We have created a sample based on the code you shared. Unfortunately, we are quite unclear about your requirement and scenario regarding the "changing date with date picker". Could you please take a look at the sample?


Could you please provide the following information in order to replicate your problem at our end:

  • Can you please share your exact code in your application, or can you please share the issue replicating sample?
  • If possible, please modify the shared sample with the issue-replicating code.
  • Can you share the exact replication procedure to check your issue at our end?
  • If possible, please share a video demonstrating the issue.


The above information helps us provide a better solution from our end.


Regards,

Vinothkumar



Attachment: BlazorApp1_b381b182_(1)_d0900af3.zip


NK Nandor Kalmanchey August 2, 2023 07:54 AM UTC

Hi! I will attach a video and a code example where I face with the problem.


code:

<h3>Teszt</h3>


@using Syncfusion.Blazor.Kanban

@using Syncfusion.Blazor.Calendars


    <SfDatePicker @bind-Value="dateValue" Format="yyyy.MM.dd" Width="200px" FirstDayOfWeek="1">

            <DatePickerEvents TValue="DateTime?" ValueChange="onChange"></DatePickerEvents>

    </SfDatePicker>

    <SfKanban TValue="KanbanDataModel" DataSource="@cardData" Height="100%" Width="100%" KeyField="datum">

        <KanbanColumns>

                    <KanbanColumn HeaderText="Hétfő" KeyField="@(new List<string>() { days.monday })" ></KanbanColumn>

                    <KanbanColumn HeaderText="Kedd" KeyField="@(new List<string>() { days.tuesday })" ></KanbanColumn>

                    <KanbanColumn HeaderText="Szerda" KeyField="@(new List<string>() { days.wednesday })" ></KanbanColumn>

                    <KanbanColumn HeaderText="Csütörtök" KeyField="@(new List<string>() { days.thursday })" ></KanbanColumn>

                    <KanbanColumn HeaderText="Péntek" KeyField="@(new List<string>() { days.friday })" ></KanbanColumn>

                    <KanbanColumn HeaderText="Szombat" KeyField="@(new List<string>() { days.saturday })" ></KanbanColumn>

                    <KanbanColumn HeaderText="Vasárnap" KeyField="@(new List<string>() { days.sunday })" ></KanbanColumn>

        </KanbanColumns>

        <KanbanCardSettings HeaderField="id" ContentField="cardname"></KanbanCardSettings>

    </SfKanban>




@code {


    public class KanbanDataModel

    {

        public int id { get; set; }

        public int sorszam { get; set; }

        public string datum { get; set; }

        public string cardcode { get; set; }

        public string cardname { get; set; }


        public List<KanbanDataModel> GetTasks()

        {

            var taskDetails = new List<KanbanDataModel>

            {

                new KanbanDataModel { id = 1, sorszam = 1, datum = "2023.08.01", cardcode = "V000256", cardname = "DMK CSERHÁT 2000 KFT.#"},

                new KanbanDataModel { id = 2, sorszam = 2, datum = "2023.08.01", cardcode = "V000256", cardname = "DMK CSERHÁT 2000 KFT.#"},

                new KanbanDataModel { id = 3, sorszam = 1, datum = "2023.08.03", cardcode = "V000256", cardname = "DMK CSERHÁT 2000 KFT.#"},

                new KanbanDataModel { id = 4, sorszam = 2, datum = "2023.08.03", cardcode = "V000256", cardname = "DMK CSERHÁT 2000 KFT.#"},

                new KanbanDataModel { id = 5, sorszam = 3, datum = "2023.08.03", cardcode = "V000256", cardname = "DMK CSERHÁT 2000 KFT.#"},

                new KanbanDataModel { id = 6, sorszam = 1, datum = "2023.08.05", cardcode = "V000256", cardname = "DMK CSERHÁT 2000 KFT.#"}

            };

            return taskDetails;

        }

    }

    public class Days

    {

        public string monday { get; set; } = "";

        public string tuesday { get; set; } = "";

        public string wednesday { get; set; } = "";

        public string thursday { get; set; } = "";

        public string friday { get; set; } = "";

        public string saturday { get; set; } = "";

        public string sunday { get; set; } = "";

    }


    public DateTime? dateValue { get; set; }


    protected Days days = new Days();


    private List<KanbanDataModel> cardData = new KanbanDataModel().GetTasks();


    public async Task onChange(ChangedEventArgs<DateTime?> args)

    {

        if (args.Value.HasValue)

        {

            await DateChanged();

        }

    }


    protected async Task DateChanged()

    {

        await LoadKanbanData();

    }


    public async Task LoadKanbanData()

    {

        if ((int)dateValue?.DayOfWeek == 0)

        {

            days.monday = dateValue?.AddDays(-6).ToString("yyyy.MM.dd");

            days.tuesday = dateValue?.AddDays(-5).ToString("yyyy.MM.dd");

            days.wednesday = dateValue?.AddDays(-4).ToString("yyyy.MM.dd");

            days.thursday = dateValue?.AddDays(-3).ToString("yyyy.MM.dd");

            days.friday = dateValue?.AddDays(-2).ToString("yyyy.MM.dd");

            days.saturday = dateValue?.AddDays(-1).ToString("yyyy.MM.dd");

            days.sunday = dateValue?.ToString();

        }

        else

        {

            days.monday = dateValue?.AddDays(1 - (int)dateValue?.DayOfWeek).ToString("yyyy.MM.dd");

            days.tuesday = dateValue?.AddDays(2 - (int)dateValue?.DayOfWeek).ToString("yyyy.MM.dd");

            days.wednesday = dateValue?.AddDays(3 - (int)dateValue?.DayOfWeek).ToString("yyyy.MM.dd");

            days.thursday = dateValue?.AddDays(4 - (int)dateValue?.DayOfWeek).ToString("yyyy.MM.dd");

            days.friday = dateValue?.AddDays(5 - (int)dateValue?.DayOfWeek).ToString("yyyy.MM.dd");

            days.saturday = dateValue?.AddDays(6 - (int)dateValue?.DayOfWeek).ToString("yyyy.MM.dd");

            days.sunday = dateValue?.AddDays(7 - (int)dateValue?.DayOfWeek).ToString("yyyy.MM.dd");

            DateTime? monday = dateValue?.AddDays(1 - (int)dateValue?.DayOfWeek);

        }


        cardData = new KanbanDataModel().GetTasks();

    }

}



Attachment: 20230802_095022_38680de3.rar


VY Vinothkumar Yuvaraj Syncfusion Team August 4, 2023 04:51 PM UTC

Hi Nandor Kalmanchey,


We have logged the reported issue as a bug on our end, and a fix will be included in our patch release scheduled for the end of August. You can track the status of the issue by using the feedback link below.


https://www.syncfusion.com/feedback/45912/when-dynamically-changing-the-keyfield-in-a-kanban-component-it-throws-a-console


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,

Vinothkumar



NK Nandor Kalmanchey August 31, 2023 06:39 AM UTC

Hi, 


Sorry I can't reach the url, I mean it shows me that "Acces Denied". Maybe bcs I changed my accounts email.

Could you please help me with this issue?


Thanks for your help!

Nándor



VY Vinothkumar Yuvaraj Syncfusion Team August 31, 2023 02:11 PM UTC

Hi Nandor Kalmanchey,


We have included the fix for the issue "When dynamically changing the keyfield in a Kanban component, it throws a console error" with our package version 22.2.11. So, can you please upgrade your package to the latest to resolve the issue from your end.


Release noteshttps://blazor.syncfusion.com/documentation/release-notes/22.2.11?type=all#kanban


Loader.
Up arrow icon