Events

Once your board is configured you can use the events of the component to interact with the data.

Event Name
Description

WorkItemDragged

Set when a Work Item card is dragged by a user

AddWorkItem

Set when a user selects a Boards Add new item icon

WorkItemSelected

Set when the user clicks on a Work Item Title

OnChange property

This property will be triggered as any change happens on the kanban. The events presented above will be detected and you can define the outcome by using a switch statement:

Switch(
    Self.EventType,
    "WorkItemDragged",
    Patch(
        WorkProgressTracker,
        LookUp(
            WorkProgressTracker,
            ID = Value(Self.CurrentWorkItemID)
        ),
        {
            Progress: Switch(
                Self.CurrentBoardID,
                "1",
                {Value: "Not started"},
                "2",
                {Value: "In progress"},
                "3",
                {Value: "Completed"},
                "4",
                {Value: "Blocked"}
            )
        }
    ),
    "WorkItemSelected",
    Set(
        _Record,
        LookUp(
            WorkProgressTracker,
            ID = Value(Self.CurrentWorkItemID)
        )
    );
    EditForm(FormTasks);
    Navigate(
        'New Task Screen test',
        Fade
    ),
    "AddWorkItem",
    NewForm(FormTasks);
    Navigate(
        'New Task Screen test',
        Fade
    );
    Set(
        _DefaultProgress,
        Switch(
            Self.CurrentBoardID,
            "1",
            {Value: "Not started"},
            "2",
            {Value: "In progress"},
            "3",
            {Value: "Completed"},
            "4",
            {Value: "Blocked"}
        )
    )
)

Add new item using kanban board

Selecting the plus icon on any of the board sections will trigger the event "AddNewItem". As you can see in the formula we just create we are setting up a variable to store what is the progress.

This will allow us to have the Progress selection of our form pre-filled. We just need to use the formula below on the datacard Default property:

If(FormTasks.Mode = FormMode.Edit, ThisItem.Progress, _DefaultProgress)
Control wll be filled based on the selected progress

Editing item using Kanban board

As you click any of the cards, the event "WorkItemSelected" will be triggered. As this happens we are storing the record into the variable _Record and turning the state of the form to edit mode. This will allow us to edit the record on the form.

On item property of the form place the variable:

_Record

Last updated