tags:

views:

298

answers:

2

My problem is that empy rows (if there are more rows that dataSource items then there are empy rows) look identical to rows binded to dataSource items which are empy (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?

+3  A: 

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!

yn2
uhh.. I hoped for something a bit easier.. Maybe I'll add a column with a labelFuncion that displays an "*" if there's a row in the dataSource.thanks anyway
luca
A: 

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.

invertedSpear
nice idea! I'll try it, thanks
luca