Premium support for our pure JavaScript UI components


Post by sprabhu »

Hi,
Can you please let us know if if we can apply 'Zoom to fit' automatically on load.


Post by marcio »

Hey sprabhu,

You can use the following event listener to trigger the function after the render

listeners: {
	dependenciesDrawn: ({source}) => {
		source.zoomToFit();
	}
}

Best regards,
Márcio


Post by sprabhu »

Hi Marcio,
Thanks for the reply. The code you shared works perfectly when we load the gantt for the first time. But when we click on 'zoom to fit' button on the Advanced demo, its lands on some random period.
I have recorded the steps by editing the 'Advanced Demo' and shared the link below. Please let me know if you need any more details related to this issue.https://frontrol-my.sharepoint.com/personal/cgupta_frontrol_com/_layouts/15/stream.aspx?id=%2Fpersonal%2Fcgupta%5Ffrontrol%5Fcom%2FDocuments%2FRecordings%2FMeeting%20with%20Chirag%20Gupta%2D20230523%5F223811%2DMeeting%20Recording%2Emp4&ga=1


Post by marcio »

Hey sprabhu,

I couldn't access that link, it displays the following screen.

Attachments
Screenshot 2023-05-24 at 11.51.00.png
Screenshot 2023-05-24 at 11.51.00.png (66.09 KiB) Viewed 230 times

Best regards,
Márcio


Post by sprabhu »


Post by alex.l »

We have a feature request for this functionality here https://github.com/bryntum/support/issues/5144
Btw, this event should fits better to zoomToFit needs, because data might be recalculated after load

project : {
   // ...
   listeners : {
        dataready : {
            fn() {
                gantt.zoomToFit();
            },
            once : true // call it only once
        }
    }

I also reproduced the bug you mentioned here and opened a ticket https://github.com/bryntum/support/issues/6852

All the best,
Alex


Post by sprabhu »

Thanks for raising the ticket. Please do keep us posted once this is addressed.


Post by alex.l »

You can subscribe on ticket updates using the link posted and be notified by email immediately when ticket changed the status.

All the best,
Alex


Post by sprabhu »

ok will do that. Thanks


Post Reply