Hello,
I'm calling bringIntoView() once my diagram has been initialized, in order to fit the diagram into the space available.
I'm doing that by subscribing to the requestEnd event of the datasource, as below:
var
datasource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"MyDataUrl"
,
type:
"POST"
,
dataType:
"json"
,
}
},
requestEnd:
function
(e) {
setTimeout(
function
() { ZoomToFit(); },200);
},
});
function
ZoomToFit() {
var
diagram = $(
"#myDiagram"
).getKendoDiagram();
diagram.bringIntoView(diagram.shapes);
}
I found that calling ZoomToFit() directly from the event was too quick, and would attempt to perform the action before the diagram had been initially displayed, so I used a timeout.
The problem I have is that in some cases, even with the timeout, the ZoomToFit() method is called before the diagram is initially displayed.
I therefore need a method of performing that initial bringIntoView() as soon as the diagram has been displayed. Is there a better event I should be using?
Note that calling bringIntoView() straight after initializing the diagram is also too early, it would seem. And I can't just extend the timeout, as this will be perceived as a jump, for users whose diagram does display quickly.
Thanks,
George