--- In flexcoders@yahoogroups.com, "Manish Jethani" <manish.jeth...@...> wrote: > > On Wed, Dec 31, 2008 at 9:34 PM, vincy8080 <vincy8...@...> wrote: > > > Why is the CSS style not applied to my button in the datagrid > > itemrenderer (see code below)? What should I do to apply the style > > "buttonStyle" to the button in the itemrenderer? > > Well, it seems the DataGrid just overwrites your 'styleName' setting > with its own. It sets the styleName of the renderer to point to the > DataGridColumn object. > > Here's a workaround: > > <mx:itemRenderer> > <mx:Component> > <mx:Button label="xxx" > preinitialize="event.target.styleName = 'myButton'" /> > </mx:Component> > </mx:itemRenderer> > > i.e. set styleName in the renderer's preinitialize handler. This way > you overwrite the DataGrid's setting. > > Manish >
Yes, it works. Thank you Manish! :)