Notes on Java, Solaris, PHP, LDAP…

November 17, 2007

Flickering Adobe Flex custom renderer for DataGrid

Filed under: Uncategorized — negev @ 8:22 pm
Tags:

Data grid render which knows what column it’s rendering:
It is supposed to do the same job as the previous renderer – it renders columns lines differently if the data row has ‘is_admin’ field set. However, the following renderer is flickering!

package {
import mx.controls.DataGrid;
import mx.controls.dataGridClasses.DataGridItemRenderer;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.Text;
import mx.controls.dataGridClasses.DataGridColumn;

public class MemberRenderer extends DataGridItemRenderer {
public function MemberRenderer() { super(); }
private var lastUID:String; // the last thing we rendered

override public function set data(value:Object):void {
super.data = value;

if (listData && listData.uid != lastUID) {
//styleChanged(“color”);
var dgListData:DataGridListData = listData as DataGridListData;
var dataGrid:DataGrid = dgListData.owner as DataGrid;
var column:DataGridColumn = dataGrid.columns[dgListData.columnIndex];

if (value.is_admin == true) {
styleName = “adminStyle”;
}
text = data[column.dataField];
lastUID = listData.uid;
}
}
}
}

Advertisements

1 Comment »

  1. Just me, but I never trust the operator order of precedence; I use parentheses to insure that the operations are doing what I think they are:

    if ((listData != null) && (listData.uid != lastUID))

    Comment by Richard C Haven — January 24, 2009 @ 9:48 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: