Note that there are some explanatory texts on larger screens.

plurals
  1. POScale a Spark DataGrid with Fixed rowCount & No Scollers
    text
    copied!<p><img src="https://i.stack.imgur.com/m6Asf.png" alt="This is resize is scaling by: stage.scaleMode = StageScaleMode.SHOW_ALL; // No Good cause just the Datagrids need to scale"></p> <p>I am trying to find a way to Scale (either font or scaleX&amp;Y) a DataGrid (with requestedMinRowCount = requestedMaxRowCount = requestedRowCount = dataProviderLength), so that it would Always show all the Rows (so no scrollers).</p> <p>A Solution I came up with for Scaling is:</p> <pre><code>protected function thisDatagrid_resizeHandler(event:ResizeEvent):void { if (event.oldWidth &lt; this.width) { this.setStyle('fontSize', this.getStyle('fontSize') + 0.5); } else if (event.oldWidth &gt; this.width) { this.setStyle('fontSize', this.getStyle('fontSize') - 0.5); } this.minWidth = this.measuredMinWidth; } </code></pre> <p>While the code above actually does resize the text (hence the cell, column and grid) on Resize, the problem I am getting is when the rescale happens vertically.</p> <p>For the requestedRowCount to work, there should <strong>not</strong> be a fixed height set on the Datagrid. So I am wondering what is the way to get the grid to constantly show all it's rows &amp; columns as it scales (even if resized vertically)?</p> <p>Another Option would be overriding updateDisplayList, though not straight forward for resizing.</p> <pre><code>override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); trace('oldWidth: ' + oldWidth + ' | unscaledWidth: ' + unscaledWidth + ' | parentWidth: ' + this.parent.width); trace('oldHeight: ' + oldHeight + ' | unscaledHeight: ' + unscaledHeight + ' | parentHeight: ' + this.parent.height); trace('Potential ScaleX: ' + (unscaledWidth - oldWidth)/unscaledWidth); trace('Potential ScaleY: ' + (unscaledHeight - oldHeight)/unscaledHeight); trace('----------------------------------------------------'); /* scaleX = (unscaledWidth - oldWidth)/unscaledWidth; scaleY = (unscaledHeight - oldHeight)/unscaledHeight; */ //super.updateDisplayList(unscaledWidth, unscaledHeight); } </code></pre> <p>The problem with this if I uncomment scaleX &amp; scaleY, it'll loop forever...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload