item renderer between two columns

hi guys

I have a datagrid with 2 columns

the first column contains combobox, the second column contains textbox

On my second column(textbox) i have a itemrenderer defined

private function createColumn(columnIndex:int,fieldObject:Object):AdvancedDataGridColumn{
var column:AdvancedDataGridColumn = new AdvancedDataGridColumn();
if(column.dataField == 'col2'){ //textbox column                   
column.itemRenderer  = new ClassFactory(IconItemRenderer);  
}

if(column.dataField == 'col1'){ //combobox column                   
My requirment is if the combobox is clicked, i want to invoke the IconItemRenderer.
}

Any idea how i can do that?

thanks
royjaydAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

royjaydAuthor Commented:
public class IconItemRenderer extends HBox implements IDropInListItemRenderer {   

		private var hBox:HBox;	 
		private var comments:Label;
		
		protected var _listData:DataGridListData;
		public function get listData():BaseListData
		{
			return _listData;
		}
		public function set listData(value:BaseListData):void
		{
			_listData = DataGridListData(value);
			invalidateProperties();
		}
		
		public function IconItemRenderer ()
		{
			super();
		}
		
		override protected function createChildren():void{
			super.createChildren();
			hBox= new HBox();		
			hBox.visible = true;			
			comments = new Label();
			this.addChild(hBox);
		}
		
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
super.updateDisplayList(unscaledWidth,unscaledHeight);
}//
		
override public function set data ( value : Object ) : void {
super.data = value;
if ( value ) {
				
comments.text   = value["col2"] as String;	
hBox.addChild(comments);
if(comments.text != null){
setStyle("borderColor", 0xFF3300);
	}
} 
}
}

Open in new window

0
zzynxSoftware engineerCommented:
>> My requirment is if the combobox is clicked, i want to invoke the IconItemRenderer.
What do you mean with "invoke" it? A renderer set on a column just renders the data in that column. Always.
Maybe you mean: if the combobox is clicked, i want my IconItemRenderer to render the data in another way.
That's possible by using an attribute (eg. a Boolean flag) that you set when the combo box is clicked.
And if that attribute is set, your renderer renders the data in another way compared with when it is not set.

Remark:
"if the combo is clicked" that means on whatever row of you datagrid the combo box is clicked.
Because "the combo box" is used to render that first column for all rows
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dgofmanCommented:
royjayd,
Why are you creating column renderer when user clicked on the row?
0
zzynxSoftware engineerCommented:
Thanx 4 axxpeting, royjyad.
I have a question, though: Why are you giving points to dgofman who's just asking you a question?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.