Remove Element when selecting Resource

Our Kanban Task Board for easy management of tasks and agile workflows
Post Reply
User avatar
b.wust
Premium Member
Premium Member
Posts: 70
Joined: Fri Mar 11, 2011 12:37 pm

Remove Element when selecting Resource

Post by b.wust »

Hi, i have a Question About the Taskboard.

When i select a Special User as Resource i want to remove the Element from the Taskboard.
For Example when i select Brian in your Advanced Example i want to remove it.

how can i do that ?
taskboard.png
taskboard.png (225.18 KiB) Viewed 4037 times

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2997
Joined: Fri Apr 01, 2016 11:08 am

Re: Remove Element when selecting Resource

Post by pmiklashevich »

Hello,

Please see API: https://www.bryntum.com/docs/taskboard-for-extjs/#!/api/Kanban.view.TaskView-method-taskRenderer

Code: Select all

Ext.define('Kanban.examples.advanced.view.KanbanPanel', {
    viewConfig : {
        taskRenderer : function (task, renderData) {
            // better to compare to ID of the resource
            if (task.getResource() && task.getResource().getName() === 'Brian') {
                renderData.ImageUrl = null;
            }
        }
    },
Best,
Pavel
Pavel Miklashevich - Core Developer

User avatar
b.wust
Premium Member
Premium Member
Posts: 70
Joined: Fri Mar 11, 2011 12:37 pm

Re: Remove Element when selecting Resource

Post by b.wust »

Thx for the fast Reply, but this is only Setting the Image to null. I want to completly remove the Entry where i select for example Brian from the Taskboard that it is not shown anymore.

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2997
Joined: Fri Apr 01, 2016 11:08 am

Re: Remove Element when selecting Resource

Post by pmiklashevich »

What do you mean by "Element"? I got it as Image element. Do you mean task element? There are 2 options to "remove" task element:

1. Remove the task from the store

Code: Select all

        taskBoard.taskStore.on('update', function(store, record) {
            if (record.getResource() && record.getResource().getName() === 'Brian') {
                store.remove(record);
            }
        });
https://docs.sencha.com/extjs/7.0.0/classic/Ext.data.Store.html#method-remove

2. Filter out task from the store

Code: Select all

        taskBoard.taskStore.filterBy(function(record) {
            return !record.getResource() || record.getResource().getName() !== 'Brian';
        });
https://docs.sencha.com/extjs/7.0.0/classic/Ext.data.Store.html#method-filterBy
Pavel Miklashevich - Core Developer

User avatar
b.wust
Premium Member
Premium Member
Posts: 70
Joined: Fri Mar 11, 2011 12:37 pm

Re: Remove Element when selecting Resource

Post by b.wust »

Thanks pmiklashevich, that is exactly what i was searching for.
I Need to remove the task from the store completly if a Special resource is selected.

Post Reply