History | Log In     View a printable version of the current page.  
Issue Details (XML)

Key: SDK-15305
Type: Bug Bug
Status: Reopened Reopened
Priority: C C
Assignee: SDK Community
Reporter: Bill Shirley
Votes: 5
Watchers: 7
Operations

If you were logged in you would be able to see more operations.
Flex SDK

PrintDataGrid doesn't allow multiple instances of the class to be correctly displayed

Created: 04/15/08 03:27 PM   Updated: 03/31/09 05:53 PM
Component/s: mx: PrintDataGrid
Security Level: Public (All JIRA Users )

File Attachments: 1. File PrintGridTest.mxml (2 kb)
2. File PrintGridTest2.mxml (2 kb)
3. File PrintSubsection.mxml (0.7 kb)
4. File PrintSubsection2.mxml (0.7 kb)


Severity: Incorrectly Functioning
Reproducibility: Every Time
Discoverability: Medium
Found in Version: SDK Flex 3 (Released)
Milestone: SDK Community Fix Candidates
Affected OS(s): Mac - OS 10.4
Steps to Reproduce:
Steps to reproduce:
1. Create two PrintDataGrid instances, first with small, second with larger data sets
2. add both to the same parent for display
 
 Actual Results:
 All successive PrintDataGrid instances are same size
 
 Expected Results:
 All data ve viewable.
 
 Workaround (if any):
none known
 
---
from source included:
Test 1: create grids with fewer rows, then with more, larger data sets are not displayed
restart application:
Test 2: create 4 grids, with 4 rows each,
the word-wrap and multi-line content causes later data grids to lose a row
 
Language Found: English
Bugbase Id: none
Triaged: Yes
Regression: No
QA Owner: Robert Vollmar (Adobe)
Participants: Bill Shirley, Iwo Banas, Robert Vollmar (Adobe) and SDK Community
Browser: Other (specify version)
JDK: Sun 1.5.x


 All   Comments      Sort Order:
Bill Shirley - [04/15/08 04:05 PM ]
May be related to
  https://bugs.adobe.com/jira/browse/SDK-14174
but exhibiting other anomalies, too.

Robert Vollmar (Adobe) - [04/16/08 06:49 PM - edited ]
I might be misunderstanding the issue, but it seems to be behaving properly. A PrintDataGrid's sizeToPage property defaults to true, meaning it will only show the number of rows that can be displayed and still have the PrintDataGrid fit in its container (in this case, a ViewStack). I made the ViewStack's backgroundColor white, and as I played with the sliders, saw that the number of rows in the PrintDataGrids changed so that each PrintDataGrid could be displayed in the ViewStack. To view the next page of data, call the PrintDataGrid's nextPage() method. Or, if you don't want this functionality of showing few enough rows to stay within its container, set sizeToPage to false.

Please let me know whether I'm misunderstanding the issue or this clears things up. Thanks!

Bill Shirley - [04/17/08 10:22 AM ]
main source file, version 2

Bill Shirley - [04/17/08 10:22 AM ]
secondary source file, version 2

Bill Shirley - [04/17/08 10:31 AM ]
Problem still exists...

I uploaded new versions of the files.

I removed the ViewStack, using only the VBox.
The Test1 problem from the main report appears to be fixed in the original by setting the resizeToContent="true" for the ViewStack.
The Test2 problem still appears - it looks like a sizing negotiation problem with VBox and (perhaps) the dynamic content - or variable width rows of PrintDataGrid.

If you run it, with 4 grids, 4 rows - the last rows are cut off of the later grids.
If you forcefully set the VBox height=800, they all display correctly.

This provides a workaround of manually computing the needed height for the VBox.

Bill Shirley - [04/18/08 02:41 PM ]
The cause seems to be a side effect of measuring the height of the PrintDataGrid - it sets the _originalHeight from NaN to an actual value. The code is also using the fact that _originalHeight is NaN to decide whether to send a value or -1 to the measuring methods.

It's hard to understand what the _originalHeight variable is supposed to be doing. The following is obviously not the right fix, but it does correct the problem for the given case.

override protected function measure():void
{
var oldRowCount:uint = rowCount;

var count:uint = (dataProvider) ? dataProvider.length : 0;

if (count >= verticalScrollPosition)
count -= verticalScrollPosition;
else
count = 0;

if (headerVisible)
count++;

setRowCount(count);

// need to calculate rowCount before super()
super.measure();
measureHeight();

/*if (isNaN(_originalHeight))
_originalHeight = measuredHeight; ********************************************************/
_currentPageHeight = measuredHeight;

if (!sizeToPage)
{
setRowCount(oldRowCount);
super.measure();
}
}

override public function setActualSize(w:Number, h:Number):void
{
if (!isNaN(percentHeight))
{
// _originalHeight = h; ************************************************************************
super.percentHeight = NaN;
measure();
h = measuredHeight;
}

super.setActualSize(w, h);

invalidateDisplayList();

if (sizeToPage && !isNaN(explicitHeight))
explicitHeight = NaN;
}



This is unchanged, but is called twice for each print grid, the second time _originalHeight has been set to a value other than NaN....

private function measureHeight():void
{
if (dataProvider && dataProvider.length > 0
&& (verticalScrollPosition >= dataProvider.length))
{
setRowCount(0);
measuredHeight = 0;
measuredMinHeight = 0;
return;
}

var o:EdgeMetrics = viewMetrics;
        var rc:int = (explicitRowCount < 1) ? rowCount : explicitRowCount;

//***********************************************************************
        var maxHeight:Number = isNaN(_originalHeight) ? -1
         : _originalHeight - o.top - o.bottom;

measuredHeight = measureHeightOfItemsUptoMaxHeight(
-1, rc, maxHeight) + o.top + o.bottom;

measuredMinHeight = measureHeightOfItemsUptoMaxHeight(
-1, Math.min(rc, 2), maxHeight) + o.top + o.bottom;
}


Robert Vollmar (Adobe) - [04/28/08 03:43 PM ]
Alex says it's a bug. Able to reproduce in 2.0.1 and 3.0.

Robert Vollmar (Adobe) - [06/24/08 08:06 PM - edited ]
Consider the PrintDataGrid family of bugs for 3.0.x.

Iwo Banas - [03/28/09 01:10 PM ]
I am working on quashing this bug.