Telerik Forums
UI for ASP.NET MVC Forum
0 answers
108 views
I'm thinkin on develop a taskboard but I would need to disable the drag and drop event, because I want to show some tasks on it, just to have clear information about the performance of my team. Can I disable drag and drop from Taskboards? Or maybe do I have to use another Telerik component?
Alberto
Top achievements
Rank 2
 asked on 07 Jul 2022
1 answer
81 views

Hello, I'm attempting to "undo" an "invalid" card move on a taskboard between 2 cols with specified states.

I'll add the HtmlHelper code:


@(Html.Kendo().TaskBoard()
    .Name("kittingTaskBoard")
    .ColumnSettings(s =>
    {
        s.TemplateId("column-template");
        s.Width("320");
        s.Buttons(b =>
        {

        });

    })
    .Columns(c =>
    {
        c.Add().Text("On Hold").Status("2");
        c.Add().Text("New").Status("1");
        c.Add().Text("In Work").Status("3");
        c.Add().Text("Staged").Status("4");
        c.Add().Text("Verified").Status("5");
    })
    .Editable(false)
    .DataDescriptionField("ShipNumber")
    .DataTitleField("Control")
    //.DataOrderField("PriorityId")
    .DataStatusField("StatusId") 
    .TemplateId("card-template")
    .Events(events => events.MoveStart("onKitSessionStartMove").MoveEnd("onKitSessionMove"))
    .DataSource(source => source.Ajax().Read(read => read.Action("GetKittingQueue", "Fulfillment")))
    .Height("980")
    .Events(ev => ev.DataBound("onDataBound").ColumnsDataBound("onColumnsDataBound")))

I'll add the validation code:


        const manager = {
            claim: function(id, uid) {
                $.ajax('@Url.Action("ClaimKitSession", "Fulfillment")',
                    {
                        method: "Post",
                        data: getAntiForgeryToken({ id })
                    }).done(function(response) {
                    notify(response);
                }).fail(function(error) {
                    notify(error.responseJSON);
                });
            },
            valid: function(from, to) {
                console.log(`[valid]: ${from} > ${to}`);
                if ((from === "3" && to === "1") // InWork > New
                        ||
                        (from === "3" && to === "2") // InWork > OnHold
                        ||
                        (from === "4" && to === "3") // Staged > InWork
                        ||
                        (from === "5" && to === "4") // Verified > Staged
                        ||
                        (from === "1" && to === "4") // New > Staged
                        ||
                        (from === "1" && to === "5") // New > Verified
                ) {
                    return false;
                }
                return true;
            }
        }


I'll add the Move Event code:


        function onKitSessionStartMove(e) {
            state.card = null;
            state.col = "0";
        }

        function onKitSessionMove(e) {
            if (state.card !== null) {
                if (!isUndefined(e.card)) {
                    if (e.card.RowId === state.card.RowId) {
                        if (!isUndefined(e.column)) {
                            if (e.column.Status === state.col) {
                                return;
                            }
                        }
                    }
                }
            } else {
                state.card = e.card;
                state.col = e.column.Status;
                return;
            }
            state.card = e.card;
            state.prev = state.col;
            state.col = e.column.Status;

            setBadgeText();

            if (manager.valid(state.prev, state.col)) {
                if (state.col === "3") {
                    manager.claim(state.card.RowId);
                }
            } else {
                toastr.warning("Invalid action prevented, you do not have permission to perform this action",
                    "Warning",
                    { positionClass: "toast-bottom-right", containerId: "toast-bottom-right" });
            }

        }

I was wondering If i could there was a card function or something I can call when the validation fails to move it back to it's previous column?

Ivan Danchev
Telerik team
 answered on 26 Oct 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?