flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Vanderberg (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-34907) Data grid column widths become progressively narrower as window resized
Date Tue, 14 Jul 2015 15:18:04 GMT

    [ https://issues.apache.org/jira/browse/FLEX-34907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14626465#comment-14626465

Joshua Vanderberg commented on FLEX-34907:

Here is sample code.  Run it in a browser and then resize the window width, back and forth
repeatedly.  Each time you increase and decrease the width, the first 5 columns will become
a little bit narrower.  Keep doing it and eventually they get down to 20 px.

I have patched this issue several times in successive SDK with the original calculation from
the Flex 3.1 SDK, the issue seems to be related to the use of Math.floor in width calculations,
for example Line 3053.
newSize = Math.floor(lastColumn.width - (totalWidth - displayWidth) * ratio);

Replacing this (and the other similar occurrences of Math.floor) with:
newSize = lastColumn.width - (totalWidth - displayWidth) * ratio;

Corrects the issue.

Adding horizontalScrollPolicy="on" to the data grid.

Example code to reproduce:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application width="100%" height="100%" xmlns:mx="http://www.adobe.com/2006/mxml" resize="application1_resizeHandler(event)"
			import mx.events.ResizeEvent;
			protected function application1_resizeHandler(event:ResizeEvent):void
				if (grid) {
					trace("Width: "+grid.columns[0].width);
	<mx:DataGrid id="grid" width="100%" height="100%" >
			<mx:DataGridColumn width="300" headerText="This is column 1" />
			<mx:DataGridColumn width="300" headerText="This is column 2" />
			<mx:DataGridColumn width="300" headerText="This is column 3" />
			<mx:DataGridColumn width="300" headerText="This is column 4" />
			<mx:DataGridColumn width="300" headerText="This is column 5" />	

> Data grid column widths become progressively narrower as window resized
> -----------------------------------------------------------------------
>                 Key: FLEX-34907
>                 URL: https://issues.apache.org/jira/browse/FLEX-34907
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: mx: DataGrid
>    Affects Versions: Apache Flex 4.13.0
>         Environment: All
>            Reporter: Joshua Vanderberg
>            Priority: Minor
> As a DataGrid's width is resized, a loss of precision in DataGrid.calculateColumnSizes()
causes columns to become progressively narrower, losing their original width.

This message was sent by Atlassian JIRA

View raw message