Flex: generic checkbox header renderer

This post utilizes the checkbox item renderer from the previous post.
Here I have applied the same generic checkbox renderer approach to use as a headerRenderer on every DataGridColumn.

Again – as in the previous post, you do not have to change anything.
Just drop the CheckBoxHeaderRenderer class into your headerRenderer property of any data grid column – it will take of itself!

Marking the check box in the header will set all the corresponding data provider values to be true – thus marking all checkboxes in the item renderer.
Unmarking it will do the opposite.

It works in both ways!
If all the checkboxes in all the item renderer (on this column only) are marked – the checkbox at the header will be marked too.
In the other case – not all the checkboxes are marked – the header checkbox will update itself to be not marked.

Demo is here (right click for source)
Source is here


Flex: generic checkbox item renderer

This is a VERY generic CheckBox item renderer to use in a DataGrid.
All you have to do is drop it in your DataGridColumn and it will take care of himself.
Only thing you need to make sure is the data it receives to be a Boolean.

You do not have to give it any data specific values (e.g. name of the dataField…).

Notice (#1) the implementation of IDropInListItemRenderer.
Notice (#2) the forced dispatching of a CollectionEvent.COLLECTION_CHANGE event, this is done to notify the data provider change.

p.s. This is part of another post I’ll post later about check boxes in data grid.

Demo is here (right click for source)
Source is here