luca
luca

Reputation: 12601

Flex dataGrid how to color empty rows?

My problem is that empty rows (if there are more rows that dataSource items then there are empty rows) look identical to rows binded to dataSource items which are empty (see the difference?).

The only way to know the difference is to hover over them with the mouse, and if they are empty there's no color change, otherwise there's the blue background of the selection..

I want to change the color or in some way hide empty rows, those that are not bound to a dataSource item. How can I accomplish this?

Upvotes: 0

Views: 1163

Answers (2)

invertedSpear
invertedSpear

Reputation: 11054

I'm not sure if this is exactly what you are looking for but I cut off my rows at the end of my dataprovider like this:

myGrid.rowCount = myDP.length();

This can of course be modified with some simple logic to have min, max, or if it's a data entry type of grid length()+1.

Upvotes: -1

David Salzer
David Salzer

Reputation: 872

You can format your DataGrid using ItemRenderer.

The itemRenderer is a display object that get the data from the data provider and display it in the grid. Writing your own logic can help your specific data display in general. in this case, check for data on the ItemRenderer object creationComplete. it the data is null or empty - display a sign (or whatever).

See this link as reference: http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/

Enjoy!

Upvotes: 4

Related Questions