I'm trying to make my layout update the width of another element, but I need to get at its width NOT including its scrollbar (if one is indeed present). getMainContentBounds() in this case seems to be returning the entire width along with the scrollbar.
开发者_StackOverflowI have also tried getSizes() with the same result.
myDataTable.on('postRenderEvent', function() {
var bounds = YAHOO.specify.app.layout.getMainContentBounds();
Dom.setStyle(YAHOO.util.Selector.query('div.yui-dt-hd', c.body), 'width', bounds.width+'px');
Dom.setStyle(YAHOO.util.Selector.query('div.yui-dt-bd', c.body), 'width', bounds.width+'px');
});
Why don't you place your a marker "element" inside the scrollable.
<div style="width: 200px; overflow: auto;">
<div id="the-div-width">
Your content.
</div>
</div>
Then just focus on getting the width on the-div-width's actual width...
精彩评论