Change size of scheduler at runtime

I want to resize the scheduler at runtime.
Using something like

			scheduler.attachEvent("onViewChange", function (mode , date){
				if (mode == 'timeline')

doesn’t work well, because when the size changes from 1000 to 500 the scheduler gets “cut” (until browser window is resized which causes the scheduler to repaint).
How can I do this?

Try to use onBeforeViewChange instead of onViewChange

P.S. be sure to return true from onBeforeViewChange handler

It works, thx!