http://www.returnundefined.com/2006/11/creating-truly-reusable-renderers-with-classfactory/
HTH, Ben --- In flexcoders@yahoogroups.com, Sajid Hussain <[EMAIL PROTECTED]> wrote: > > Thanks . > Scot, actuly I m working on select all checkbox at header have u seeeen any example of tht ? right now I have button to select all and de select all . I hope ur solution will work out :) > > > > ----- Original Message ---- > From: Scott Melby <[EMAIL PROTECTED]> > To: flexcoders@yahoogroups.com > Sent: Wednesday, December 19, 2007 8:05:56 PM > Subject: Re: [flexcoders] Re: DataGrid ItemRenderes HEADERS? > > > > > > > > > > > > > > > > > > > I haven't done this from a custom header... so sorry if this is way off > base. But, perhaps you could dispatch an event with bubbles = true > from the click handler rather than trying to call a method. Just make > sure you register as a listener (on the datagrid) for the event type > that you are dispatching. Seems the event should bubble out to you. > > > > hth > > Scott > > > Scott Melby > Founder, Fast Lane Software LLC > http://www.fastlane sw.com > > > > > Sajid Hussain wrote: > > > > hey > ..... > > I want to add checkbox control in datagrid header ,I alredy render tht > checkbox but problem is that I m not able to call function from on that > click even I tried parentDocument. callMyfunction( ); ..its > giving me error but the same method I have applied to rows checkbox its > working but header its not wroking ... > > but with application refrence I m able to calllllll ..... > > > > ANy help > > > > ----- > Original Message ---- > > From: rueter007 <[EMAIL PROTECTED] co.uk> > > To: [EMAIL PROTECTED] ups.com > > Sent: Wednesday, December 19, 2007 10:47:05 AM > > Subject: [flexcoders] Re: DataGrid ItemRenderes - How to access the > {data} from the datagrid > > > > > You are doing a few things wrong here. use the following source in > > your itemrenderer. mxml file > > > > <?xml version="1.0" encoding="utf- 8"?> > > <mx:Application xmlns:mx="http://www.adobe. > com/2006/ mxml" > > xmlns:local= "*" > > > > > <mx:Script> > > <![CDATA[ > > import mx.events.ListEvent ; > > > > [Bindable] private var dp:Array = [ > > { symbol: "ADBE", name: "Adobe Systems Inc.", price: 49.95, bold: true > }, > > { symbol: "MACR", name: "Macromedia Inc.", price: 39.95, bold: false }, > > { symbol: "MSFT", name: "Microsoft Corp.", price: 25.95, bold: true }, > > { symbol: "IBM", name: "IBM Corp.", price: 42.55, bold: false } > > ]; > > > > private function changeHandler( event:ListEvent) :void > > { > > var item: Object = event.itemRenderer. data; > > > > item.bold = !item.bold; > > dg1.dataProvider. itemUpdated( item); > > } > > > > // Sets the styles to display the DataGrid Items > > private function computeStyles( data:Object, column:DataGridColu > mn):Object > > { > > var o:Object = new Object(); > > > > var bold:String = data["bold"] ; > > if (bold == "true") > > { > > o.bold = true; > > } else { > > o.bold = false; > > } > > > > return o; > > } > > > > ]]> > > </mx:Script> > > > > <mx:DataGrid id="dg1" dataProvider= "{dp}" > > change="changeHandl er(event) " paddingTop=" 0" paddingBottom= "0" > > verticalAlign= "middle" > > > <mx:columns> > > <mx:DataGridColumn headerText=" Name" dataField="name" width="140"/ > > > > <mx:DataGridColumn headerText=" Symbol" dataField="symbol" > width="60" /> > > <local:CustomColumn stylesFunction= "computeStyles" headerText=" > Price" > > dataField="price" itemRenderer= "CustomRenderer" /> > > </mx:columns> > > </mx:DataGrid> > > > > </mx:Application> > > > > The most important issue here is that the changeHandler is modifying > > the dp array which is not the same as the dataprovider of the grid. > > you need to get a handle to the actual item in the grid's dataprovider > > using the event.itemrenderer. data property and make changes to it. I > > > > HTH > > > > - venkat > > http://www.venkatj. com > > > > --- In [EMAIL PROTECTED] ups.com, > "m.frigge" <m.frigge@ .> wrote: > > > > > > Hey Mark, > > > > > > I'm struggling with itemRenderers too. First of all here > > > > > <http://blogs. > adobe.com/ aharui/2007/ 03/thinking_ about_item_ renderers_ 1.h\ > > > tml> is a link to Alex's blog speaking about > itemRenderers and showing > > > some nice examples. In the BlinkWhenDataChange d example he is > changing > > > Background settings. I tried to adopt his itemRenderer and change > it so > > > that it checks a data value and sets the textFormat depending on > what > > > value the data has. This > > > <http://16-bits. > com/ItemRenderer /ItemRenderer. html> is how far i came. > > > I toggle the value on change, so when you click it the style > changes. My > > > only Problem is that it doesn't work anymore after sorting the > dataGrid > > > by one of its columns. Maybe we can work on this together :-). > > > > > > Cheers, Max > > > > > > --- In [EMAIL PROTECTED] ups.com, > "oneproofdk" <mark@> wrote: > > > > > > > > Hi. > > > > In a itemrenderer I'd like to access a {data} value in a > Script in the > > > > itemrenderer. I just can't figure out how to do this. > > > > > > > > I have an ArrayCollection as the dataprovider for the > DataGrid. > > > > In a Column, I sue a itemrenderer "status" > > > > > > > > Inside renderer.status. as I have a VBox, with a init() > function. > > > > Inside init I'd like to test if "data.repeating" != null and > if so, > > > > set a label to a specific value, if not null, set to another > value. > > > > > > > > <vbox><script> </script> <label/>< > /vbox> > > > > > > > > Please - can anyone help me out with an example on how to > accomplish > > > > this, I hope, simple task. > > > > > > > > (The reason for using a VBox was that I had my hopes for > setting the > > > > background color also, so if != null color=XX + text = XX etc. > > > > > > > > Thanks for your time > > > > Mark > > > > > > > > > > > > > > > > > > > > > > > > > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. > > > > > > > > > > > > > > > > <!-- > > #ygrp-mkp{ > border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;} > #ygrp-mkp hr{ > border:1px solid #d8d8d8;} > #ygrp-mkp #hd{ > color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;} > #ygrp-mkp #ads{ > margin-bottom:10px;} > #ygrp-mkp .ad{ > padding:0 0;} > #ygrp-mkp .ad a{ > color:#0000ff;text-decoration:none;} > --> > > > > <!-- > > #ygrp-sponsor #ygrp-lc{ > font-family:Arial;} > #ygrp-sponsor #ygrp-lc #hd{ > margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;} > #ygrp-sponsor #ygrp-lc .ad{ > margin-bottom:10px;padding:0 0;} > --> > > > > <!-- > > #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;} > #ygrp-mlmsg table {font-size:inherit;font:100%;} > #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;} > #ygrp-mlmsg pre, code {font:115% monospace;} > #ygrp-mlmsg * {line-height:1.22em;} > #ygrp-text{ > font-family:Georgia; > } > #ygrp-text p{ > margin:0 0 1em 0;} > #ygrp-tpmsgs{ > font-family:Arial; > clear:both;} > #ygrp-vitnav{ > padding-top:10px;font-family:Verdana;font-size:77%;margin:0;} > #ygrp-vitnav a{ > padding:0 1px;} > #ygrp-actbar{ > clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;} > #ygrp-actbar .left{ > float:left;white-space:nowrap;} > .bld{font-weight:bold;} > #ygrp-grft{ > font-family:Verdana;font-size:77%;padding:15px 0;} > #ygrp-ft{ > font-family:verdana;font-size:77%;border-top:1px solid #666; > padding:5px 0; > } > #ygrp-mlmsg #logo{ > padding-bottom:10px;} > > #ygrp-vital{ > background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;} > #ygrp-vital #vithd{ > font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;} > #ygrp-vital ul{ > padding:0;margin:2px 0;} > #ygrp-vital ul li{ > list-style-type:none;clear:both;border:1px solid #e0ecee; > } > #ygrp-vital ul li .ct{ > font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;} > #ygrp-vital ul li .cat{ > font-weight:bold;} > #ygrp-vital a{ > text-decoration:none;} > > #ygrp-vital a:hover{ > text-decoration:underline;} > > #ygrp-sponsor #hd{ > color:#999;font-size:77%;} > #ygrp-sponsor #ov{ > padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;} > #ygrp-sponsor #ov ul{ > padding:0 0 0 8px;margin:0;} > #ygrp-sponsor #ov li{ > list-style-type:square;padding:6px 0;font-size:77%;} > #ygrp-sponsor #ov li a{ > text-decoration:none;font-size:130%;} > #ygrp-sponsor #nc{ > background-color:#eee;margin-bottom:20px;padding:0 8px;} > #ygrp-sponsor .ad{ > padding:8px 0;} > #ygrp-sponsor .ad #hd1{ > font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;} > #ygrp-sponsor .ad a{ > text-decoration:none;} > #ygrp-sponsor .ad a:hover{ > text-decoration:underline;} > #ygrp-sponsor .ad p{ > margin:0;} > o{font-size:0;} > .MsoNormal{ > margin:0 0 0 0;} > #ygrp-text tt{ > font-size:120%;} > blockquote{margin:0 0 0 4px;} > .replbq{margin:4;} > --> > > > > > > > > > ____________________________________________________________________________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping >