Premium support for our pure JavaScript UI components


Post by Howard »

Hello,

I'm struggling to get the Task Board Project taskModelClass property to work. I'd like to extend the model to add field configuration and custom methods.

In this example, I am setting the property to MyCustomTaskModel but the "name" field defaultValue does not take effect. Also, the logging shows the defaultValue is an empty string. I assume MyCustomTaskModel isn't being honored with this setup.

https://codepen.io/Howrd/pen/rNoGbNR

Am I doing something wrong here?


Post by marcio »

Hey Howard,

As you can see here https://bryntum.com/products/taskboard/docs/api/TaskBoard/model/ProjectModel#config-taskModelClass the taskModelClass is a config, not a property, which means that they can't be changed on runtime.

In the Codepen, changing to

const taskBoard = new TaskBoard({
    appendTo : document.body,
    project: {
      taskModelClass: MyCustomTaskModel
    },
    // Columns to display
    columns : [
        'todo',
        'doing',
        'done'
    ],

// Field used to pair a task to a column
columnField : 'status'
});

makes it work correctly.

Attachments
Screenshot 2023-09-18 at 14.13.53.png
Screenshot 2023-09-18 at 14.13.53.png (326.67 KiB) Viewed 111 times

Best regards,
Márcio


Post by Howard »

Hi marcio, thanks for the quick reply.

Your suggestion works great! I did not appreciate it was a config only, thanks for pointing this out.

I have now updated the CodePen to try to use a custom project model which references the custom task model. This is how we are currently using the project/task models in our app, but the custom task model again isn't taking effect. Is there an issue with this setup?


Post by marcio »

Hey Howard,

Thanks for the update. That looks like a bug, I created a ticket to fix that https://github.com/bryntum/support/issues/7519

Best regards,
Márcio


Post by Howard »

Thanks marcio, I appreciate it. :)


Post Reply