[flexcoders] Re: Need to different images in datagrid column
thanks for the code, But i could not understand clearly, here is my sample code to apply pdf and word icon under img column --Code starts- ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Image [Bindable] private var initDG:ArrayCollection = new ArrayCollection([ {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99, SalePrice: true,img:pdf }, {Artist:'Pavement', Album:'Brighten the Corners',img:word, Price:11.99, SalePrice: false } ]); ]] /mx:Script mx:DataGrid id=myGrid dataProvider={initDG} variableRowHeight=true mx:columns mx:DataGridColumn dataField=Artist/ mx:DataGridColumn dataField=Album/ mx:DataGridColumn dataField=Price/ mx:DataGridColumn dataField=img/ /mx:columns /mx:DataGrid /mx:Application --Code ends--- - Vinoth --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Try something like (foo contains 'pdf' or 'word'): mx:Script import mx.controls.Image private function addGif(o, c) { return o.foo + .gif } mx:DataGridColumn labelFunction=addGif itemRenderer=Image / From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Vinoth Babu Sent: Tuesday, April 03, 2007 8:05 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Need to different images in datagrid column Thanks for your info . But I need to load images according to the data. for e.g. In a column , if a data is 'pdf' then load 'pdf.gif' or if it's 'word' load 'word.gif' pdf.gif or word.gif or... are shown in one column in a different row each Thanks , Vinoth Jack OMelia [EMAIL PROTECTED] wrote: Try using an itemRenderer. Create a separate component that looks like this: (saved as imageRenderer.mxml in the comps directory) ?xml version=1.0 encoding=utf-8? mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml paddingBottom=0 paddingLeft=0 paddingRight=0 paddingTop=2 width=50 height=20 horizontalAlign=center mx:Image source=images/image.gif width=14 height=14 / /mx:HBox then add it to your datagrid like this: mx:DataGridColumn headerText=! itemRenderer=comps.imageRenderer / HTH, Jack --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Vinoth Babu tjvinoth@ wrote: Hi, Need your help to load an different images in a datagrid column Thanks Vinoth - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. Never miss an email again! Yahoo! Toolbar http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolb ar /features/mail/ alerts you the instant new Mail arrives. Check it out. http://us.rd.yahoo.com/evt=49937/*http://tools.search.yahoo.com/toolb ar /features/mail/
RE: [flexcoders] Re: Need to different images in datagrid column
return o.img + .gif From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Vinoth Sent: Tuesday, April 03, 2007 11:47 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Need to different images in datagrid column thanks for the code, But i could not understand clearly, here is my sample code to apply pdf and word icon under img column --Code starts- ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml mx:Script ![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Image [Bindable] private var initDG:ArrayCollection = new ArrayCollection([ {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99, SalePrice: true,img:pdf }, {Artist:'Pavement', Album:'Brighten the Corners',img:word, Price:11.99, SalePrice: false } ]); ]] /mx:Script mx:DataGrid id=myGrid dataProvider={initDG} variableRowHeight=true mx:columns mx:DataGridColumn dataField=Artist/ mx:DataGridColumn dataField=Album/ mx:DataGridColumn dataField=Price/ mx:DataGridColumn dataField=img/ /mx:columns /mx:DataGrid /mx:Application --Code ends--- - Vinoth --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex Harui [EMAIL PROTECTED] wrote: Try something like (foo contains 'pdf' or 'word'): mx:Script import mx.controls.Image private function addGif(o, c) { return o.foo + .gif } mx:DataGridColumn labelFunction=addGif itemRenderer=Image / From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Vinoth Babu Sent: Tuesday, April 03, 2007 8:05 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Re: Need to different images in datagrid column Thanks for your info . But I need to load images according to the data. for e.g. In a column , if a data is 'pdf' then load 'pdf.gif' or if it's 'word' load 'word.gif' pdf.gif or word.gif or... are shown in one column in a different row each Thanks , Vinoth Jack OMelia [EMAIL PROTECTED] wrote: Try using an itemRenderer. Create a separate component that looks like this: (saved as imageRenderer.mxml in the comps directory) ?xml version=1.0 encoding=utf-8? mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml paddingBottom=0 paddingLeft=0 paddingRight=0 paddingTop=2 width=50 height=20 horizontalAlign=center mx:Image source=images/image.gif width=14 height=14 / /mx:HBox then add it to your datagrid like this: mx:DataGridColumn headerText=! itemRenderer=comps.imageRenderer / HTH, Jack --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com , Vinoth Babu tjvinoth@ wrote: Hi, Need your help to load an different images in a datagrid column Thanks Vinoth - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. Never miss an email again! Yahoo! Toolbar http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolb http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolb ar /features/mail/ alerts you the instant new Mail arrives. Check it out. http://us.rd.yahoo.com/evt=49937/*http://tools.search.yahoo.com/toolb http://us.rd.yahoo.com/evt=49937/*http://tools.search.yahoo.com/toolb ar /features/mail/
[flexcoders] Re: Need to different images in datagrid column
Try using an itemRenderer. Create a separate component that looks like this: (saved as imageRenderer.mxml in the comps directory) ?xml version=1.0 encoding=utf-8? mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml; paddingBottom=0 paddingLeft=0 paddingRight=0 paddingTop=2 width=50 height=20 horizontalAlign=center mx:Image source=images/image.gif width=14 height=14 / /mx:HBox then add it to your datagrid like this: mx:DataGridColumn headerText=! itemRenderer=comps.imageRenderer / HTH, Jack --- In flexcoders@yahoogroups.com, Vinoth Babu [EMAIL PROTECTED] wrote: Hi, Need your help to load an different images in a datagrid column Thanks Vinoth - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends.
Re: [flexcoders] Re: Need to different images in datagrid column
Thanks for your info . But I need to load images according to the data. for e.g. In a column , if a data is 'pdf' then load 'pdf.gif' or if it's 'word' load 'word.gif' pdf.gif or word.gif or... are shown in one column in a different row each Thanks , Vinoth Jack OMelia [EMAIL PROTECTED] wrote: Try using an itemRenderer. Create a separate component that looks like this: (saved as imageRenderer.mxml in the comps directory) ?xml version=1.0 encoding=utf-8? mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml; paddingBottom=0 paddingLeft=0 paddingRight=0 paddingTop=2 width=50 height=20 horizontalAlign=center mx:Image source=images/image.gif width=14 height=14 / /mx:HBox then add it to your datagrid like this: mx:DataGridColumn headerText=! itemRenderer=comps.imageRenderer / HTH, Jack --- In flexcoders@yahoogroups.com, Vinoth Babu [EMAIL PROTECTED] wrote: Hi, Need your help to load an different images in a datagrid column Thanks Vinoth - Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. - Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.