Expand my Community achievements bar.

SOLVED

Flex - Data grid property

Avatar

Level 2
Hi folks,



Good morning...



Is there any possibility to add a button in Data grid.. ?



I am stuck up in a scenario like this..



I am displaying a hotel list with hotel name , its rate and
availabilty in a datagrid in three columns.




Against each row in the data grid , i need to add a button as
'Book Now' which redirects me to next page.



I tried to include this button in the fourth column of data
grid.. .




But flex is not allowing me to add any controls in data
grid..



I need to add images and button against each hotel in the
list.



How can i acheive this functionality..



Please give me suggestion on this...



Thanks in Advance,

Ambili Surendran









1 Accepted Solution

Avatar

Correct answer by
Level 2
Thanks Mete for ur reply.



I have already solved the problem. Item renderer can do this
task.



<mx:DataGridColumn headerText="Book
Now"sortable="false">

<mx:itemRenderer>

<mx:Component>

<mx:HBox width="25%" horizontalCenter="0"
horizontalAlign="center">

<mx:Button id="book" label="Book Now" />

</mx:HBox>

</mx:Component>

</mx:itemRenderer>

</mx:DataGridColumn>



thx mete once again... can u please reply for the doubt i
have asked in flex data services. i have sent reply for that too..



thnx in advance

Ambili Surendran





View solution in original post

2 Replies

Avatar

Former Community Member
I haven't tried it myself but you might be able to do it with
custom item renderers. Flex documentation should have more info on
item renderers. Alex Harui's blog has some examples on item
renderers:




http://blogs.adobe.com/aharui/

Avatar

Correct answer by
Level 2
Thanks Mete for ur reply.



I have already solved the problem. Item renderer can do this
task.



<mx:DataGridColumn headerText="Book
Now"sortable="false">

<mx:itemRenderer>

<mx:Component>

<mx:HBox width="25%" horizontalCenter="0"
horizontalAlign="center">

<mx:Button id="book" label="Book Now" />

</mx:HBox>

</mx:Component>

</mx:itemRenderer>

</mx:DataGridColumn>



thx mete once again... can u please reply for the doubt i
have asked in flex data services. i have sent reply for that too..



thnx in advance

Ambili Surendran