5

Ok, just going nuts with this one.

I used rowcount, in my previous mx.datagrid

Now, with "s:datagrid", I've tried to use requesteMaxRowCount, and RequestMinRowCount (in desperation mode :/ ) The datagrid appear with 2 lines, even when my dataset only has ONE row, and requestedMaxRowCount = 1;

---edited ---

arrBranches is an ArrayCollection

if (arrBranches.length > 0){
 dgBranches.requestedMaxRowCount = arrBranches.length;
 dgBranches.dataProvider = arrBranches;
 dgBranches.visible = true;
 arrBranches.refresh(); 
} 

--- edited end---

--- 2nd edit ---

this is not possible anymore...

dgBranches.rowCount = arrBranches.length

-- Edit end --

I have no height, top, or bottom, defined... how to set the visible rows to only One row (other than header, of course) Paulo Ans

Paulo Ans
  • 51
  • 1
  • 4
  • When using a List class you set the 'requestedRowCount' values on the layout; not on the actual List. I assume that is true for the Spark DataGrid. – JeffryHouser May 05 '11 at 16:56
  • Thank you for your time. I though any value, even if declared on layout, could changed by AS code during the life cycle of the application... The number of rows to be displayed, depends on the number of row in the ArrayCollection... But, I will be trying some variations, and come back to post the result. Again, thank you. – Paulo Ans May 06 '11 at 08:55
  • For a better understanding, http://img64.imageshack.us/img64/7257/capturadeecr20110506095.png (I've removed the contents, after the print-screen, but on the second table, the array collection that works as a provider, only has one element) I've also noticed, that when the table is displayed, but before the dataprovider is set, the table already appears with 2 blank lines. I can't also, set it to zero, so that only the header appears – Paulo Ans May 06 '11 at 09:38
  • "I though any value, even if declared on layout, could changed by AS code during the life cycle of the application" This is true to an extent. It depends if the component was implemented to handle such changes. I would expect the Spark DataGrid or a layout class to handle changes on-the-fly at runtime. To solve your problem it looks like you'll have to delve into framework code. – JeffryHouser May 06 '11 at 12:42
  • áááááhhhhrgggg, I think you're right.... (where is the icon on pulling one's hair? ).... once again, thank you for your time. I can't imagine that there won't be <> to this one... – Paulo Ans May 06 '11 at 14:00
  • Give me a runnable sample and I'll try it. – JeffryHouser May 06 '11 at 15:13

3 Answers3

4

You need to set the minHeight property of your DataGrid to "0" or anything smaller than the header height.

The default minHeight is just enough to show a little over 2 rows, hence your problem.

  • If I could give you two thumbs up I would, because I've been looking for this for a long time. – Storo Nov 17 '15 at 17:31
1

I ran into this same problem/bug:

my hack-workaround is to toggle the dataGrid's height to a fixed value (55 works in my rendering) when the dataProvider has only 1 row.

Ped
  • 123
  • 1
  • 1
  • 7
  • 1
    try this: grid.height = grid.dataProvider.length * (grid.rowHeight + 1); – Dan Oct 28 '11 at 18:21
  • If you can't find the rowHeight property, try `grid.grid.rowHeight`. As per: http://hansmuller-flex.blogspot.com/2011/05/datagrid-row-heights.html – ggkmath Jan 09 '13 at 21:50
0

MHO, it is a bug that value of requesteMaxRowCount equal to 1 is not correctly respected > 2 rows are displayed instead.

You can fix it by yourself by editing framework code (somewhere near GridLayout.as class) or log the bug instead into Adobe JIRA.

JabbyPanda
  • 872
  • 5
  • 13