Page 1 of 1

[INFO REQ] The first render doesn't clean correctly the task card in taskRederer method

Posted: Thu Jun 17, 2021 11:44 pm
by licjapodaca

Hi there, I already call the method taskRenderer to clean the value of the task name that comes from our Database like so:

Screen Shot 2021-06-17 at 2.37.33 p.m..png
Screen Shot 2021-06-17 at 2.37.33 p.m..png (319.9 KiB) Viewed 1163 times

But when I call the load() method from the Taskboard Project the first renderization doesn't work like so:

Screen Shot 2021-06-17 at 2.36.48 p.m..png
Screen Shot 2021-06-17 at 2.36.48 p.m..png (124.48 KiB) Viewed 1163 times

But when I click over a task card, it triggers something that execute the taskRenderer method now correctly like so:

Screen Shot 2021-06-17 at 2.43.39 p.m..png
Screen Shot 2021-06-17 at 2.43.39 p.m..png (120.03 KiB) Viewed 1163 times

Is there a configuration that I miss...

Regards


Re: [INFO REQ] The first render doesn't clean correctly the task card in taskRederer method

Posted: Fri Jun 18, 2021 8:14 am
by johan.isaksson

Hi,

A taskRenderer is for formatting the output. We strongly recommend not assigning any values to records in it since assigning triggers another render. I will clarify this in docs.

If you need to process the data arriving from your backend you should do so on an earlier stage, perhaps in a https://bryntum.com/docs/taskboard/#TaskBoard/model/ProjectModel#event-beforeLoadApply listener


Re: [INFO REQ] The first render doesn't clean correctly the task card in taskRederer method

Posted: Fri Jun 18, 2021 5:28 pm
by licjapodaca

Excellent @johan ... Thanks for your help...

Regards


Re: [INFO REQ] The first render doesn't clean correctly the task card in taskRederer method

Posted: Fri Jun 18, 2021 7:55 pm
by licjapodaca

Hi @johan, I already use the project event "beforeloadapply" like so:

Screen Shot 2021-06-18 at 10.48.46 a.m..png
Screen Shot 2021-06-18 at 10.48.46 a.m..png (200.7 KiB) Viewed 1154 times

In the developer console I can see the data already cleaned and I already assign the cleaned data to the "event.response", but I still see the not cleaned data like so:

Screen Shot 2021-06-18 at 10.49.17 a.m..png
Screen Shot 2021-06-18 at 10.49.17 a.m..png (250.71 KiB) Viewed 1154 times

Am I doing something wrong?

Regards


Re: [INFO REQ] The first render doesn't clean correctly the task card in taskRederer method

Posted: Fri Jun 18, 2021 8:54 pm
by licjapodaca

Hi @johan, this works for me:

Screen Shot 2021-06-18 at 11.52.33 a.m..png
Screen Shot 2021-06-18 at 11.52.33 a.m..png (453.89 KiB) Viewed 1152 times

Regards


Re: [INFO REQ] The first render doesn't clean correctly the task card in taskRederer method

Posted: Sat Jun 19, 2021 7:30 am
by johan.isaksson

Hi,

The https://bryntum.com/docs/taskboard/#TaskBoard/view/TaskBoard#config-processItems hooks purpose is to determine/manipulate which items (text items, image items) etc are displayed on a tasks card. It is called on each render, thus performing actions in it that triggers a new render is not recommended.

I tried changing the project config in the columns demo to this:

project : {
        transport : {
            load : {
                url : 'data/data.json'
            }
        },

    autoLoad : true,

    onBeforeLoadApply({ response }) {
        for (const data of response.tasks.rows) {
            data.name = 'Hello';
        }
    }
}

And got this result:

Screenshot 2021-06-19 at 07.28.41.png
Screenshot 2021-06-19 at 07.28.41.png (30.13 KiB) Viewed 1150 times

Seems to work as intended, give it another shot?


Re: [INFO REQ] The first render doesn't clean correctly the task card in taskRederer method

Posted: Mon Jun 21, 2021 7:11 pm
by licjapodaca

Wow, excellent @johan, it works ... thanks

Regards