Our pure JavaScript Scheduler component


Post by jbyvik »

Heyo.

We are playing around with cellTooltips to display tooltip for our resources. When we are updating the resourcee with new Data, the tooltip doesnt reflect this change for some reason. Is there a cachee or smthn that needs to be cleared or what is happening here?

Reproduced in this example: https://bryntum.com/examples/scheduler/tooltips/

By adding this to the config:
to the features object we add

cellTooltip: {
                    tooltipRenderer: ({record}) => { 
                        return StringHelper.xss`<div>${record}</div>`
                    }
                },

and to the eventTooltip onBeeforeshow we add a function to change the resources name. This is mainly to trigger a dataChange to the resource, not something we actually implement ;)

onBeforeShow({ source : tooltip }) {
                        tooltip.title = StringHelper.encodeHtml(tooltip.eventRecord.name);
                        tooltip.eventRecord.resource.set({name: 'HELLO WORLD'});
                    },

You can see in the demo that the resource gets a new name but when hovered the tooltip still shows the old name. When you change resource it gets the new info.


Post by Animal »

The CellTooltip featre? OK, that will be primed with the resource record. The resource is the row.

But your onBeforeShow talks about tooltip.eventRecord. That's part of the EventTooltip feature. If you get no errors thrown, then I'm assuming that must be in the configuration of your EventTooltip feature.

So there are two features here and I'm a bit confused.

What UI are you trying to achieve?

When I run this:

    features : {
        cellTooltip: {
            tooltipRenderer: ({record}) => { 
                return `<div>${record.name}</div>`
            }
        },
        eventTooltip: {
            onBeforeShow({ source : tooltip }) {
                tooltip.title = tooltip.eventRecord.name;
                tooltip.eventRecord.resource.set({name: 'HELLO WORLD'});
            }
        }
    }

This happens which is what I expect. The Event tooltip shows, and the resource changes name.

itworks.gif
itworks.gif (1.76 MiB) Viewed 334 times

Obviously the cell tooltip doesn't trigger on the schedule area. That's the ScheduleTooltip that you see. Hovering that first column shows the CellTooltip, and as I have configured above, it shows the resource name:

Screenshot 2022-01-20 at 16.18.48.png
Screenshot 2022-01-20 at 16.18.48.png (13.45 KiB) Viewed 334 times

Post by jbyvik »

Haha yeah sorry, bad examples.

The feature we are wondering about is the cellTooltip :)
The issue seem to be that the cellTooltip resourceRecord is chached or saves something. Becuase if we trigger a cellTooltip over e.g. "Ellen" then (either with that cellTooltip closed or opened) we progaramtically change the resrouceRecord (e.g. resourceRecord.set name: 'hello world and then open the tooltip again the tooltip will still display Ellen as the resource Name. it corrects itself when we hover another cell and then hover our changed cell again.

so a actionflow here:
pic 1: hovering cell, everything is correct
pic 2: hovered eventTooltip, modifying resourceRecord setting new name. Works fine
pi3 3: hovered the resourceRecord again but issue here as the cellTooltip displays the previous name and not the modified name (hello world) which is also displayed on the row.

Image

if I hover another cell to fire the tooltip and then hover HELLO WORLD cell again, it display helloWorld

The event tooltip features onBeforeShow was just used as a simple way to programatically change the resourceRecord, mby we should have added a btn instead ^^


Post by Animal »

Yes, I think the issue is that if you hover the same record instance, the content calculation thinks nothing has changed.

Here is the ticket, it will be fixed in the next release: https://github.com/bryntum/support/issues/4051


Post Reply