View Full Version : Auto scroll IFramePanel on tab click

1 Jul 2010, 11:36 PM

In my application the first half of the window displays a PDF form document in an IFrame and the second half shows a tab panel with 3 tabs. All I wanted is to set the IFrame panel to automatically scroll the document to a certain height(vertical scroll bar) say 25% of the documents length when a tab is clicked. 1st Tab-25%,2ndTab-50%, 3rd Tab-75% etc. Below is the code, I'm able to get the height of the frame(iframeDoc.scrollHeight) but not able to scroll. I request for your help to resolve this.

title:'PDF Document',
xtype: 'iframepanel',
frameConfig: { autoCreate: { id: 'detail', name: 'detail'} },
defaultSrc: './MyForm.pdf',

//Tab handling
function handleActivatetab(tab) {

var iframeDoc = getIframeDocument('DocFrame');
iframeDoc.body.scrollTop = iframeDoc.body.scrollHeight - 100;

//Got the Height of the frame but does not scroll
alert('PDFHeight' + iframeDoc.scrollHeight + ' scrollTop' + iframeDoc.body.scrollHeight);
}Thanks in Advance

1 Jul 2010, 11:47 PM
The iframe does not contain an HTML document.