PDA

View Full Version : How can I clear a DataGrid


westony
12-17-2010, 08:41 PM
My whole Idea is to make REFRESH for my DG, i wanna clear it and then to load the dataProvider...

How can i Clear the DataGrid ?


Thanks in advance!

drkstr
12-17-2010, 11:12 PM
You can just set the dataProvider again.

westony
12-18-2010, 06:12 AM
I tried, but I have imagerenderer on one of the datafiled as class and its getting bugged when i do that. If i close the window and reopen it again everything is fine!

See this:
http: //img196.imageshack.us/img196/977/29544197.png
http: //img573.imageshack.us/img573/8310/27297576.png

Those images are powered by:


package
{
import mx.containers.HBox;
import mx.controls.Image;
import mx.controls.Label;
import mx.controls.dataGridClasses.*;

public class ImageRenderer extends HBox
{
private var imageReference:Image = null;
private var img:Image = new Image();
private var lbl:Label = new Label();


override public function set data(value:Object):void
{
if(value != null && imageReference == null)
{
if(value.read == false) {
img.source = "img/assets/newmail.png";
img.toolTip = "New Mail";
}
else
{
img.source = "img/assets/oldmail.png";
img.toolTip = "Old Mail";
}
}

addChild(img);
imageReference = img;
setStyle("verticalAlign", "middle");
setStyle("paddingLeft","2");




}

}
}

westony
12-18-2010, 02:20 PM
Fixed By Adding one more if the same but with imageReferance != null