Our pure JavaScript Scheduler component


Post by Aniket »

Team,

Is it possible to scroll to the a newly added resource.
I am adding a new resource on my scheduler, but I want the scheduler to scroll to the newly added resource and highlight it.

P.S, above feature is present for events, when I add a new event, I use the scrollEventIntoView method so that newly added event is highlighted and scrolled to.

Is similar sort of feature present for resource as well?


Post by pmiklashevich »

Please see https://www.bryntum.com/docs/scheduler/#Grid/view/GridBase#function-scrollRowIntoView

scheduler.scrollRowIntoView(scheduler.resourceStore.last, { highlight : true })

Pavlo Miklashevych
Sr. Frontend Developer


Post by Aniket »

Hi Pavel,

This does help me to scroll to the newly added resource, however the highlight effect is just there for a fraction of seconds and after that it fades.

I want the resource to be selected or highlighted unless the user clicks somewhere to deselect it.

Similar effect that scrollEventIntoView has

Is it possible for resource row as well?


Post by mats »


Post by Aniket »

Hi Mats,

How do I use above to highlight the row of resource when a new resource is added?
Any snippet to help?


Post by mats »

scheduler.selectedRecord = yourRecord

Post by Aniket »

this.scheduler.schedulerInstance.selectedRecord = this.scheduler.schedulerInstance.resourceStore.last

throws

Uncaught (in promise) TypeError: Cannot read property 'getBoundingClientRect' of undefined
    at Function.from (scheduler.module.js:10175)
    at Scheduler.scrollRowIntoView (scheduler.module.js:74739)
    at Scheduler.scrollRowIntoView (scheduler.module.js:74725)
    at Scheduler.selectCell (scheduler.module.js:70541)
    at Scheduler.selectRow (scheduler.module.js:70507)
    at CrudManager.<anonymous> (gantt.component.ts:1044)
    at CrudManager.trigger (scheduler.module.js:3426)
    at CrudManager.internalOnResponse (scheduler.module.js:76520)

I am using this inside crudManager's onSync method in order to highlight a resource when it is created.

Any thoughts what is going wrong?


Post by mats »

Set a breakpoint to try to understand?


Post by Aniket »

Mats,

Does the above work well in your environements?


Post by mats »

Yes, try it here: https://www.bryntum.com/examples/scheduler/basic/

Run in console:

const record = scheduler.resourceStore.add({})[0]; scheduler.selectedRecord = record;

Post Reply