v7.3.0

Binding Bryntum TaskBoard data

Bryntum TaskBoard is a data intensive component that uses several datasets. These datasets usually come from the server and are held in TaskBoard project during the lifetime of the TaskBoard view. There are several ways of populating the project data stores.

Using project transport

ProjectModel supports loading and saving of data in multiple stores with transport config. Loading the stores and saving all changes is done in one request.

Configuring project with transport is the simplest way of binding data to the TaskBoard project stores as seen from the client side, but it does require following a specific protocol on the backend.

The configuration can be as simple as setting the project property like this:

taskboardProps: {
    project : {
        loadUrl  : '/server/load/url',
        syncUrl  : '/server/save/url',
        autoLoad : true
    }
}

<BryntumTaskBoard {...taskboardProps}/>

With this configuration, the data is loaded and saved from and to the above URLs and the data transport is handled automatically.

Binding existing data to the component

When the application already has a server transport layer then the data for TaskBoard is available in application code and it needs to be passed (bound) to the component. One approach is to make the data available as component variables and bind them in the Vue template:

App.vue:

<template>
    <bryntum-task-board
        :assignments = "assignments"
        :resources = "resources"
        :tasks = "tasks"
        v-bind = taskBoardProps
    />
</template>

<script>
import { ref, reactive } from 'vue';

import { BryntumTaskBoard } from '@bryntum/taskboard-vue-3';

import { useTaskBoardProps } from '@/AppConfig';
import * as appData from '@/AppData';

export default {
    name : 'App',

    components : {
        BryntumTaskBoard
    },

    setup() {
        consttaskBoardProps = reactive(useTaskBoardProps());

        const assignments = ref(appData.assignments);
        const resources = ref(appData.resources);
        const tasks = ref(appData.tasks);

        return {
           taskBoardProps,
            assignments,
            resources,
            tasks
        };
    }
};
</script>

<style lang = "scss">
@import './App.scss';
</style>

Here we have component variables, initialized by spreading ...initialData. Whenever a change of the data is needed, it is only necessary to assign the new values to these variables, for example:

this.tasks = newTasks;
this.dependencies = newDependencies;

Binding existing data to the project

This approach binds data to a standalone TaskBoardProjectModel and then uses this project in TaskBoard. Project has its own markup in the template and it must be assigned to the TaskBoard during initialization.

This approach is suitable for more complex applications that use more than one Bryntum component that share a common project:

App.vue:

<template>
    <div>
        <bryntum-task-board-project-model
            ref = "project"
            :assignments = "assignments"
            :resources = "resources"
            :tasks = "tasks"
        />
        <bryntum-task-board
            :project = "project"
            v-bind = taskBoardProps
        />
    </div>
</template>

<script>
import { ref, reactive } from 'vue';

import { BryntumTaskBoardProjectModel, BryntumTaskBoard } from '@bryntum/taskboard-vue-3';

import { useTaskBoardProps } from '@/AppConfig';
import * as appData from '@/AppData';

export default {
    name : 'App',

    components : {
        BryntumTaskBoardProjectModel,
        BryntumTaskBoard
    },

    setup() {
        const project = ref(null);

        consttaskBoardProps = reactive(useTaskBoardProps());

        const assignments = ref(appData.assignments);
        const resources = ref(appData.resources);
        const tasks = ref(appData.tasks);

        return {
            project,
           taskBoardProps,
            assignments,
            tasks,
            resources
        };
    }
};
</script>

<style lang = "scss">
@import './App.scss';
</style>

Here we create a standalone TaskBoardProjectModel (without any rendered output) with properties bound to individual data sets.

Note that bryntum-taskboard-project-model tag must come before all other components that use it. Otherwise the project reference is not valid to these components.

Check implementation in React inline-data demo.

Contents