简体   繁体   中英

Remove blank row in Flex DataGrid (Flex 3)

I am encountering a problem similar to How can I make datagrid height is equal to data content in Adobe Flex however suggested answers did not work for me.

The blank row at the end of the DataGrid does not display at first, until I begin editing editing the last row, at which the entire grid is immediately pushed upwards, making the top row disappear and the blank bottom row reappear.

Nikhil's answer in that post said that setting the height to count the overall height including the header as well as setting the verticalScrollPolicy to off still did not help me.

Barts answer from that post usually does it for me: How can I make datagrid height is equal to data content in Adobe Flex

And then setting

 dataGrid.VerticalScrollPolicy = ScrollPolicy.OFF;

Added headerHeight to the grid to get it working for me for exactly the same problem. I don't see any correlation but that's how flex rolls.

Try the following code. It works for me!

    contentDataGrid.dataProvider = orgData;
    //contentDataGrid.rowCount=orgData.length;
    contentDataGrid.height = ((orgData.length)*18 + contentDataGrid.headerHeight+5)

Here '18' is my rowheight. As I don't want to set verticalScrollPolicy to off, I added an extra 5 to the datagrid height (to avoid the scrollbar).Assume orgData is the data provider.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM