5/31/2010 5:59:11 AM
Title:
Dynamically add HBox container in the particular selected row in the datagrid.
Hi,
With item renderer i have already added checkboxes and labels in the datagrid rows which appears on all the rows. Now I want to add custom components say an HBox on the selected datagrid row in front of the already present label. Could anybody please suggest how to achieve this.
Davis
Points: 740
Posts:0
5/31/2010 7:36:00 AM
I think you should create the required control initially in the renderer and make it invisible. It's visibility should be made false using the dataprovider value, On selection update the dataprovider with value to true where the item is selected and refresh the datagrid after that. This will make the control in that particular row visible.
5/31/2010 11:38:33 AM
but i want to add these controls in any number...in some row they can be one in other they can 4.. so how can i achieve this
6/1/2010 5:42:42 AM
use the below code to add a component dynamically to any row on click of that row
place the below code in your datagrid renderer
//call this function on your initialize event of ItemRenderer
private function init():void{
this.addEventListener(MouseEvent.CLICK,addComponent);
}
private function addComponent(evt:Event):void{
//adding button component
var btn:Button= new Button();
this.addElement(btn)
}
6/1/2010 6:18:41 AM
Hi, thanks alot for your reply bob_senior, i wanted to add child in row on selection of checkboxes outside the renderer. So could you tell me how that i can achieve. How to Set data in the renderer based on the checkboxes selected outside its renderer.
Thanks again!