[flexcoders] Re: datagrid itemRenderer help
--- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: Ha, well we wouldn't want the inmates running the asylum. Props to Amy too. I'm just wondering why Adobe wouldn't already have these kinds of checks in place. I haven't looked at Label code specifically, but I see these kinds of checks in place all the time in the Framework code. If you just use a label without extending it (I didn't see anything in the logic to suggest why extending it was necessary), do you still get the error? If so, this should probably be filed as a bug. If not, it would be interesting to try to find out what the difference is. -Amy
[flexcoders] Re: datagrid itemRenderer help
by the way, I'm using RemoteObject to access my CFC, is it possible that the itemRenderer is firing before the data is back? How would I make the data populate the ArrayCollection fooAC first before rendering the datagrid? If this is the case anyways... On Mon, Oct 6, 2008 at 1:37 PM, Greg Morphis [EMAIL PROTECTED] wrote: I'm trying to use a dataGrid itemRenderer and not sure I'm using it right. I get an error 1009 null error on data.*any_column* My data is coming back fine from the database, the column I'm trying to reference is amount mx:DataGrid id=dg width=100% height=100% dataProvider={MyModel.getInstance().FooAC} click=clickHandler(event); dataTipFunction=buildToolTip mx:DataGridColumn dataField=amount headerText=Amount: textAlign=right headerStyleName=centered labelFunction=price_labelFunc sortCompareFunction=price_sortCompareFunc itemRenderer=com.renderers.PriceLabel / The PriceLabel.as file exists in foo.com.renderers and looks like : package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } What am I doing wrong? Thanks
[flexcoders] Re: datagrid itemRenderer help
You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: by the way, I'm using RemoteObject to access my CFC, is it possible that the itemRenderer is firing before the data is back? How would I make the data populate the ArrayCollection fooAC first before rendering the datagrid? If this is the case anyways... On Mon, Oct 6, 2008 at 1:37 PM, Greg Morphis [EMAIL PROTECTED] wrote: I'm trying to use a dataGrid itemRenderer and not sure I'm using it right. I get an error 1009 null error on data.*any_column* My data is coming back fine from the database, the column I'm trying to reference is amount mx:DataGrid id=dg width=100% height=100% dataProvider={MyModel.getInstance().FooAC} click=clickHandler(event); dataTipFunction=buildToolTip mx:DataGridColumn dataField=amount headerText=Amount: textAlign=right headerStyleName=centered labelFunction=price_labelFunc sortCompareFunction=price_sortCompareFunc itemRenderer=com.renderers.PriceLabel / The PriceLabel.as file exists in foo.com.renderers and looks like : package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } What am I doing wrong? Thanks
[flexcoders] Re: datagrid itemRenderer help
--- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly...
[flexcoders] Re: datagrid itemRenderer help
Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly...
Re: [flexcoders] Re: datagrid itemRenderer help
What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] Re: datagrid itemRenderer help
I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis [EMAIL PROTECTED] wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: datagrid itemRenderer help
data is probably null the first time that updateDisplayList is called. You can either put your conditional logic in the commitProperties() or set data() methods. Override public function set data( value : Object ) : void { if (value != null) { super.data = value; this.text = data.myField; // might want to debug this line to see the data { } -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis [EMAIL PROTECTED] wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\ 1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] Re: datagrid itemRenderer help
Tim, you nailed it.. so set data keeps running until datagrid is full? I have to read up on this tonight.. but you saved my sanity! Thanks! On Mon, Oct 6, 2008 at 4:39 PM, Tim Hoff [EMAIL PROTECTED] wrote: data is probably null the first time that updateDisplayList is called. You can either put your conditional logic in the commitProperties() or set data() methods. Override public function set data( value : Object ) : void { if (value != null) { super.data = value; this.text = data.myField; // might want to debug this line to see the data { } -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis [EMAIL PROTECTED] wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: datagrid itemRenderer help
Ha, well we wouldn't want the inmates running the asylum. Props to Amy too. -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: Tim, you nailed it.. so set data keeps running until datagrid is full? I have to read up on this tonight.. but you saved my sanity! Thanks! On Mon, Oct 6, 2008 at 4:39 PM, Tim Hoff [EMAIL PROTECTED] wrote: data is probably null the first time that updateDisplayList is called. You can either put your conditional logic in the commitProperties() or set data() methods. Override public function set data( value : Object ) : void { if (value != null) { super.data = value; this.text = data.myField; // might want to debug this line to see the data { } -TH --- In flexcoders@yahoogroups.com, Greg Morphis gmorphis@ wrote: I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis gmorphis@ wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff TimHoff@ wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\ 1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links