try to set a breakpoint in the labelDisplay setter function so you can check when the object is created.
On 3 July 2014 12:09, Deepak MS <[email protected]> wrote: > My only requirement was to align the columns towards right and I thought > setting textAlign property for labelDisplay would work normally. But it > doesn't seem to, as labelDisplay is always null, I dont know why. > > So now, I am adding another label child to my itemrenderer and it does the > job. But why is labelDisplay null if we extend GridItemRenderer? I could > have avoided adding another child and performance would have been even > better I feel. > > This is what I am doing right now: > public class SpreadNormalRenderer extends GridItemRenderer > { > public var dataField:String; > public var textAlign:String = 'left'; > > private var normalLabel:StyleableTextField; > public function SpreadNormalRenderer() > { > super(); > } > > [Bindable("dataChange")] > > override protected function createChildren() : void > { > super.createChildren(); > normalLabel = new StyleableTextField(); > normalLabel.setStyle("color", AppColors.BLACK); > normalLabel.setStyle("textAlign", textAlign); > addElement(normalLabel); > } > > override protected function commitProperties():void > { > super.commitProperties(); > if(data) > { > normalLabel.text = data[dataField]; > } > > } > > override protected function updateDisplayList( > unscaledWidth:Number, unscaledHeight:Number ) : void > { > super.updateDisplayList(unscaledWidth, unscaledHeight); > normalLabel.width = unscaledWidth; > normalLabel.height = unscaledHeight; > } > > override public function set data(value:Object):void > { > // TODO Auto Generated method stub > super.data = value; > invalidateProperties(); > dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); > } > } > > And thanks for the references... : ) > > > On Wed, Jul 2, 2014 at 5:22 PM, MichaPooh <[email protected]> wrote: > > > Hellothe labelDisplay in GridItemRenderer is only optimal, because you > > could > > want to create other stuff like a checkbox, a chart component or > something > > else...You have to create an ItemRenderer based on GridItemRenderer where > > you declare/set the labelDisplay.An easy example as a MXML renderer would > > be: > > > > > > > > -- > > View this message in context: > > > http://apache-flex-users.2333346.n4.nabble.com/Spark-GridItemRenderer-tp7130p7134.html > > Sent from the Apache Flex Users mailing list archive at Nabble.com. > > > -- João Fernandes
