PDA

View Full Version : scrollWidth/scrollHeight



vaucer
21 May 2010, 7:04 AM
Hello,

I encounter little problems for get the scrollWidth/Height value of a html element into a panel:

(after i would like resize my window relative to these value)

My panel which contain a html element into a window:

var panelInfo = new Ext.Panel({
id: 'panelInfo',
border:false,
layout:'fit',
margins:'3 0 3 3',
cmargins:'3 3 3 3',
items:[{
id: 'detailPanel',
border:false,
bodyStyle: {background: '#ffffff',padding:'7px'},
html: 'exampleTpl' // For information my html its just a simple Ext.Template with html tags.
}]
});

var infoWin = new Ext.Window({
title: 'Informations',
closable:true,
closeAction:'hide',
layout:'fit',
items: [panelInfo]
});After search on forums i founded this solution:

infoWin.setWidth(0);
detailPanel.body.setStyle('overflow', 'scroll');
var w = detailPanel.body.dom.scrollWidth;
var h = detailPanel.body.dom.scrollHeight;
detailPanel.body.setStyle('overflow', '');
infoWin.setWidth(w + 20);
infoWin.setHeight(h);But the value returned with scrollWidth/Height function is never the good value and never the same try after try...

Please could you help me for read my scrollwidth/height value correctly :-/

I tried many solution but anything seem to be work.

Thank you very much for help and sorry for my english

Vaucer