The above data is for one task, which itself contains its assigned resource inside resourceAllocation. In the same way, all other tasks contain their assigned resource inside their own data.
Can you please help me with this
Re: Resource Allocation using Backend data
Posted: Wed Mar 01, 2023 4:43 pm
by Animal
It should be OK to configure your taskStore with
fields : [{
name : 'resourceId',
dataSource : 'resourceAllocation.id'
}]
In a POC.
In real life, you would use your own subclass of the default TaskModel with this as one of its defined fields.
Re: Resource Allocation using Backend data
Posted: Thu Mar 02, 2023 9:20 am
by suhas.kachare
I tried the above code inside config.project, but it's not working for me.
Below is my code
import React, { Fragment, useRef, useEffect } from "react";
import { BryntumTaskBoard, BryntumTaskBoardProps } from "@bryntum/taskboard-react";
import { TaskBoard, ProjectModel } from "@bryntum/taskboard";
import "./App.scss";
const BryntumTrial = (props: any) => {
const { reportData } = props;
const taskBoardRef = useRef<BryntumTaskBoard>(null);
const taskBoardInstance = () => taskBoardRef.current?.instance as TaskBoard;
const kanbanConfig: BryntumTaskBoardProps = {
// Url for resource avatar images
resourceImagePath: "data/TaskBoard/images/users/",
// Experimental, transition moving cards using the editor
useDomTransition: true,
// Columns to display
columns: reportData.serverData.columns,
// Field used to pair a task to a column
columnField: "state",
tasksPerRow: 1,
features: {
columnDrag: true,
columnHeaderMenu: true,
},
listeners: {
async beforeTaskDrop({ taskRecords, targetColumn }) {
// Show confirmation dialog
if (targetColumn.id === "Done") {
return false;
}
},
taskDrag({ taskRecords, targetColumn }) {
return targetColumn.id !== "Backlog";
},
},
headerItems: {
menu: { type: "taskMenu", order: 200 },
resourceAvatars: null,
},
footerItems: {
resourceAvatars: { type: "resourceAvatars" },
},
// Project using inline data
project: {
tasks: reportData.serverData.initialData,
fields: [
{
name: "resourceId",
dataSource: "resourceAllocation.id",
},
],
autoLoad: true,
// loadUrl: "data/data.json",
},
tbar: [
// Button for picking which columns to show
{ type: "columnpickerbutton" },
{ type: "zoomslider" },
],
};
return (
<Fragment>
<BryntumTaskBoard ref={taskBoardRef} {...kanbanConfig} />
</Fragment>
);
};
export default BryntumTrial;
can you please help me with this.
Re: Resource Allocation using Backend data
Posted: Thu Mar 02, 2023 11:07 am
by Animal
Configure the taskStore of the project. Not the project itself.