Re: [Junk E-Mail - LOW] Re: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
this is the snippet from my code library: package { import mx.containers.HBox; import mx.controls.CheckBox; public class CheckBox2 extends HBox{ public function CheckBox2(){ this.setStyle("horizontalAlign", "center"); } var c:mx.controls.CheckBox; override protected function createChildren():void{ c = new CheckBox(); this.addChild( c ); } override public function set data(item:Object):void { super.data = ""> if( item!=null ){ c.selected = (item.Sent == 1)?true:false ; } } } } === mxml === http://www.adobe.com/2006/mxml" layout="absolute"> = things to note: 1. Using HBox (or any containers) inside item renderer is very *expensive* (said Joan Tan from Adobe), which might be the cause for sluggish scrolling of Datagrid. 2. Most of the time my item renderer are a composition of multiple UI components, so I have to use Box or other kind of Containers. 3. Anatole's approach (using DataGridListData(listData).dataField ) is more abstractive so that the renderer is generic enough for easy reuse later, if you just need one single chechbox in there, that's the best way to go (IMHO). __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [Junk E-Mail - LOW] Re: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
That works perfectly! I'll let the code slide, since it's my first flex project :) Thanks again! Shan From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Anatole TartakovskySent: Friday, July 14, 2006 10:00 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - LOW] Re: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Shannon, Usually we have intermediary "UI Library" that solves most of such issues via extended set of props/styles (as you probably noticed with OnValue/offValue extensions on the sample). For brevity, I am just going to center it always - with code I am going to hate in the morning: package com.theriabook.controls{ import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; import mx.core.mx_internal; use namespace mx_internal; public class CheckBox extends mx.controls.CheckBox { mx_internal override function layoutContents(unscaledWidth:Number, unscaledHeight:Number, offset:Boolean):void { super.layoutContents(unscaledWidth, unscaledHeight, offset); currentIcon.x = unscaledWidth/2 - 5; } public var onValue:Object = "1"; public var offValue:Object = "0"; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null )value = item[DataGridListData(listData).dataField]; } }} Regards, Anatole On 7/14/06, Shannon Hicks <[EMAIL PROTECTED]> wrote: Heh... so, I used your class that extends the CheckBox, and functionally it works great. Unfortunately, it's still not centered, and I'm still not sure how to accomplish it. I did try to use an inline itemRenderer, and put a HBox around it (centered)... which centered the custom checkbox class, but then it threw the same error as before... ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. So... how do I center an extended checkbox? :) Shan From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Anatole TartakovskySent: Friday, July 14, 2006 7:04 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Jason, Well, I looked at your sample and it got me confused - I am sure Flex will be confused too. For one, on binding, you need to specify _expression_ that would convert selected into 1|0 like selected?1:0. Here is what I suggest to do to figure out the problem. Compile you app with -keep-generated-actionscript=true. Take a look @ 3 (guessing) files generated for your inline component. Read the code, see all the binding happening there along with overhead related to extra container and think again. Please review my posting again. Using class without container gives you what you want - in simple transparent way package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> If you think you would not be able to reuse CheckBox class or would like in place definition in the same file please consider code above nevertheless and use className on component tag so the implementation is clean and it is easy to refactor when the code review / second generation of developers come Sincerely, Anatole On 7/14/06, Pan Troglodytes < [EMAIL PROTECTED]> wrote: Anatole:You seem pretty knowledgable about Flex. Can you find any problem with the casting approach I posted? Seems like a bit less of a hassle than defining an external class. On 7/14/06, Anatole Tartakovsky &
Re: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
Shannon, Usually we have intermediary "UI Library" that solves most of such issues via extended set of props/styles (as you probably noticed with OnValue/offValue extensions on the sample). For brevity, I am just going to center it always - with code I am going to hate in the morning: package com.theriabook.controls{ import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; import mx.core.mx_internal; use namespace mx_internal; public class CheckBox extends mx.controls.CheckBox { mx_internal override function layoutContents(unscaledWidth:Number, unscaledHeight:Number, offset:Boolean):void { super.layoutContents(unscaledWidth, unscaledHeight, offset); currentIcon.x = unscaledWidth/2 - 5; } public var onValue:Object = "1"; public var offValue:Object = "0"; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null )value = item[DataGridListData(listData).dataField]; } }} Regards, Anatole On 7/14/06, Shannon Hicks <[EMAIL PROTECTED]> wrote: Heh... so, I used your class that extends the CheckBox, and functionally it works great. Unfortunately, it's still not centered, and I'm still not sure how to accomplish it. I did try to use an inline itemRenderer, and put a HBox around it (centered)... which centered the custom checkbox class, but then it threw the same error as before... ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. So... how do I center an extended checkbox? :) Shan From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Anatole TartakovskySent: Friday, July 14, 2006 7:04 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Jason, Well, I looked at your sample and it got me confused - I am sure Flex will be confused too. For one, on binding, you need to specify _expression_ that would convert selected into 1|0 like selected?1:0. Here is what I suggest to do to figure out the problem. Compile you app with -keep-generated-actionscript=true. Take a look @ 3 (guessing) files generated for your inline component. Read the code, see all the binding happening there along with overhead related to extra container and think again. Please review my posting again. Using class without container gives you what you want - in simple transparent way package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> If you think you would not be able to reuse CheckBox class or would like in place definition in the same file please consider code above nevertheless and use className on component tag so the implementation is clean and it is easy to refactor when the code review / second generation of developers come Sincerely, Anatole On 7/14/06, Pan Troglodytes < [EMAIL PROTECTED]> wrote: Anatole:You seem pretty knowledgable about Flex. Can you find any problem with the casting approach I posted? Seems like a bit less of a hassle than defining an external class. On 7/14/06, Anatole Tartakovsky < [EMAIL PROTECTED]> wrote: You can use this class as your item renderer package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these
RE: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
Heh... so, I used your class that extends the CheckBox, and functionally it works great. Unfortunately, it's still not centered, and I'm still not sure how to accomplish it. I did try to use an inline itemRenderer, and put a HBox around it (centered)... which centered the custom checkbox class, but then it threw the same error as before... ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. So... how do I center an extended checkbox? :) Shan From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Anatole TartakovskySent: Friday, July 14, 2006 7:04 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - LOW] Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Jason, Well, I looked at your sample and it got me confused - I am sure Flex will be confused too. For one, on binding, you need to specify _expression_ that would convert selected into 1|0 like selected?1:0. Here is what I suggest to do to figure out the problem. Compile you app with -keep-generated-actionscript=true. Take a look @ 3 (guessing) files generated for your inline component. Read the code, see all the binding happening there along with overhead related to extra container and think again. Please review my posting again. Using class without container gives you what you want - in simple transparent way package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> If you think you would not be able to reuse CheckBox class or would like in place definition in the same file please consider code above nevertheless and use className on component tag so the implementation is clean and it is easy to refactor when the code review / second generation of developers come Sincerely, Anatole On 7/14/06, Pan Troglodytes <[EMAIL PROTECTED]> wrote: Anatole:You seem pretty knowledgable about Flex. Can you find any problem with the casting approach I posted? Seems like a bit less of a hassle than defining an external class. On 7/14/06, Anatole Tartakovsky < [EMAIL PROTECTED]> wrote: You can use this class as your item renderer package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> Styling and dealing with settings controls defaults without drop-in itemRenderer requires subclassing of DataGridColumn and it's ClassFactory - described in details in upcoming Flex book, but would take about 5 pages to explain. Nevertheless, the case is "classical, will try to respond via components forum Thank you, Anatole On 7/14/06, Shannon Hicks < [EMAIL PROTECTED]> wrote: Pan- I tried this, and the checkbox shows up properly checked/unchecked. Now, I get this error when I change the state: ReferenceError: Error #1069: Property selected not found on
Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
Jason, Well, I looked at your sample and it got me confused - I am sure Flex will be confused too. For one, on binding, you need to specify _expression_ that would convert selected into 1|0 like selected?1:0. Here is what I suggest to do to figure out the problem. Compile you app with -keep-generated-actionscript=true. Take a look @ 3 (guessing) files generated for your inline component. Read the code, see all the binding happening there along with overhead related to extra container and think again. Please review my posting again. Using class without container gives you what you want - in simple transparent way package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> If you think you would not be able to reuse CheckBox class or would like in place definition in the same file please consider code above nevertheless and use className on component tag so the implementation is clean and it is easy to refactor when the code review / second generation of developers come Sincerely, Anatole On 7/14/06, Pan Troglodytes <[EMAIL PROTECTED]> wrote: Anatole:You seem pretty knowledgable about Flex. Can you find any problem with the casting approach I posted? Seems like a bit less of a hassle than defining an external class. On 7/14/06, Anatole Tartakovsky < [EMAIL PROTECTED]> wrote: You can use this class as your item renderer package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> Styling and dealing with settings controls defaults without drop-in itemRenderer requires subclassing of DataGridColumn and it's ClassFactory - described in details in upcoming Flex book, but would take about 5 pages to explain. Nevertheless, the case is "classical, will try to respond via components forum Thank you, Anatole On 7/14/06, Shannon Hicks < [EMAIL PROTECTED]> wrote: Pan- I tried this, and the checkbox shows up properly checked/unchecked. Now, I get this error when I change the state: ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. Shan From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On Behalf Of Pan TroglodytesSent: Friday, July 14, 2006 2:58 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Flash knows how to convert 0/1 to Boolean, it just doesn't always know WHEN to do it. To answer both your questions, here is a modified version of the help example: http://www.adobe.com/2006/mxml" height="700" width="700"> On 7/14/06, Shannon Hicks < [EMAIL PROTECTED]> wrote: I have a dataGrid where I'd like to use a checkbox drop-in renderer/editor. My query returns two columns: name [varchar(45)] and featured [smallint]. Featured returns either 1 or 0. Now, in the dataGrid, my featured column looks like this: First off... The checkbox doesn't show checked/unchecked according to the value of featured (1 or 0). Do I need to somehow convert 1 & 0 to boolean values? Isn't flash supposed to do this automatically? Secondly... The checkbox isn't centered. I'm not sure how to do that, as silly as it sounds. Shan --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 2
Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
Anatole:You seem pretty knowledgable about Flex. Can you find any problem with the casting approach I posted? Seems like a bit less of a hassle than defining an external class. On 7/14/06, Anatole Tartakovsky <[EMAIL PROTECTED]> wrote: You can use this class as your item renderer package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> Styling and dealing with settings controls defaults without drop-in itemRenderer requires subclassing of DataGridColumn and it's ClassFactory - described in details in upcoming Flex book, but would take about 5 pages to explain. Nevertheless, the case is "classical, will try to respond via components forum Thank you, Anatole On 7/14/06, Shannon Hicks < [EMAIL PROTECTED]> wrote: Pan- I tried this, and the checkbox shows up properly checked/unchecked. Now, I get this error when I change the state: ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. Shan From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Pan TroglodytesSent: Friday, July 14, 2006 2:58 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Flash knows how to convert 0/1 to Boolean, it just doesn't always know WHEN to do it. To answer both your questions, here is a modified version of the help example: http://www.adobe.com/2006/mxml" height="700" width="700"> On 7/14/06, Shannon Hicks < [EMAIL PROTECTED]> wrote: I have a dataGrid where I'd like to use a checkbox drop-in renderer/editor. My query returns two columns: name [varchar(45)] and featured [smallint]. Featured returns either 1 or 0. Now, in the dataGrid, my featured column looks like this: First off... The checkbox doesn't show checked/unchecked according to the value of featured (1 or 0). Do I need to somehow convert 1 & 0 to boolean values? Isn't flash supposed to do this automatically? Secondly... The checkbox isn't centered. I'm not sure how to do that, as silly as it sounds. Shan --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
Woops, one small correction. If you want to preserve your 0/1, do this: public var value:uint; On 7/14/06, Pan Troglodytes <[EMAIL PROTECTED]> wrote: You may have figured out the reason by now, but if not it's because editorDataField=selected is making it look for the selected attribute on the top level component. Unfortunately, when I added a canvas to make the centering work, the canvas because the top level. So it gets a little more complicated. You could break this out into separate files, but I'll just show you how to do it inline: Put this before the DataGrid: And make the column like this: This should properly expose and linkup the variable. There might be better ways to do this. This is just what I've come up with.On 7/14/06, Shannon Hicks <[EMAIL PROTECTED] > wrote: Pan- I tried this, and the checkbox shows up properly checked/unchecked. Now, I get this error when I change the state: ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. Shan From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Pan TroglodytesSent: Friday, July 14, 2006 2:58 PMTo: flexcoders@yahoogroups.com Subject: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Flash knows how to convert 0/1 to Boolean, it just doesn't always know WHEN to do it. To answer both your questions, here is a modified version of the help example: http://www.adobe.com/2006/mxml " height="700" width="700"> On 7/14/06, Shannon Hicks <[EMAIL PROTECTED]> wrote: I have a dataGrid where I'd like to use a checkbox drop-in renderer/editor. My query returns two columns: name [varchar(45)] and featured [smallint]. Featured returns either 1 or 0. Now, in the dataGrid, my featured column looks like this: First off... The checkbox doesn't show checked/unchecked according to the value of featured (1 or 0). Do I need to somehow convert 1 & 0 to boolean values? Isn't flash supposed to do this automatically? Secondly... The checkbox isn't centered. I'm not sure how to do that, as silly as it sounds. Shan --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason --No virus found in this incoming message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason -- Jason __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
You may have figured out the reason by now, but if not it's because editorDataField=selected is making it look for the selected attribute on the top level component. Unfortunately, when I added a canvas to make the centering work, the canvas because the top level. So it gets a little more complicated. You could break this out into separate files, but I'll just show you how to do it inline: Put this before the DataGrid: And make the column like this: This should properly expose and linkup the variable. There might be better ways to do this. This is just what I've come up with.On 7/14/06, Shannon Hicks <[EMAIL PROTECTED] > wrote: Pan- I tried this, and the checkbox shows up properly checked/unchecked. Now, I get this error when I change the state: ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. Shan From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Pan TroglodytesSent: Friday, July 14, 2006 2:58 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Flash knows how to convert 0/1 to Boolean, it just doesn't always know WHEN to do it. To answer both your questions, here is a modified version of the help example: http://www.adobe.com/2006/mxml" height="700" width="700"> On 7/14/06, Shannon Hicks <[EMAIL PROTECTED]> wrote: I have a dataGrid where I'd like to use a checkbox drop-in renderer/editor. My query returns two columns: name [varchar(45)] and featured [smallint]. Featured returns either 1 or 0. Now, in the dataGrid, my featured column looks like this: First off... The checkbox doesn't show checked/unchecked according to the value of featured (1 or 0). Do I need to somehow convert 1 & 0 to boolean values? Isn't flash supposed to do this automatically? Secondly... The checkbox isn't centered. I'm not sure how to do that, as silly as it sounds. Shan --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason --No virus found in this incoming message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
You can use this class as your item renderer package com.theriabook.controls { import mx.controls.CheckBox; import mx.controls.dataGridClasses.DataGridListData; public class CheckBox extends mx.controls.CheckBox { public var onValue:Object = 1; public var offValue:Object = 0; public function set value(o:Object) :void { selected = (o == onValue); } public function get value():Object { return selected?onValue:offValue; } override public function set data(item:Object):void { super.data = ""> if( item!=null ) value = item[DataGridListData(listData).dataField]; } } } and these attributes on the datagridcolumn ... itemRenderer="com.theriabook.controls.CheckBox" rendererIsEditor="true" editorDataField="value"> Styling and dealing with settings controls defaults without drop-in itemRenderer requires subclassing of DataGridColumn and it's ClassFactory - described in details in upcoming Flex book, but would take about 5 pages to explain. Nevertheless, the case is "classical, will try to respond via components forum Thank you, Anatole On 7/14/06, Shannon Hicks <[EMAIL PROTECTED]> wrote: Pan- I tried this, and the checkbox shows up properly checked/unchecked. Now, I get this error when I change the state: ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. Shan From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Pan TroglodytesSent: Friday, July 14, 2006 2:58 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Flash knows how to convert 0/1 to Boolean, it just doesn't always know WHEN to do it. To answer both your questions, here is a modified version of the help example: http://www.adobe.com/2006/mxml" height="700" width="700"> On 7/14/06, Shannon Hicks < [EMAIL PROTECTED]> wrote: I have a dataGrid where I'd like to use a checkbox drop-in renderer/editor. My query returns two columns: name [varchar(45)] and featured [smallint]. Featured returns either 1 or 0. Now, in the dataGrid, my featured column looks like this: First off... The checkbox doesn't show checked/unchecked according to the value of featured (1 or 0). Do I need to somehow convert 1 & 0 to boolean values? Isn't flash supposed to do this automatically? Secondly... The checkbox isn't centered. I'm not sure how to do that, as silly as it sounds. Shan --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor
Pan- I tried this, and the checkbox shows up properly checked/unchecked. Now, I get this error when I change the state: ReferenceError: Error #1069: Property selected not found on flexComponents.editMouse_inlineComponent1 and there is no default value. Shan From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pan TroglodytesSent: Friday, July 14, 2006 2:58 PMTo: flexcoders@yahoogroups.comSubject: [Junk E-Mail - MED] Re: [flexcoders] dataGrid drop-in itemRenderer/Editor Flash knows how to convert 0/1 to Boolean, it just doesn't always know WHEN to do it. To answer both your questions, here is a modified version of the help example: http://www.adobe.com/2006/mxml" height="700" width="700"> On 7/14/06, Shannon Hicks <[EMAIL PROTECTED]> wrote: I have a dataGrid where I'd like to use a checkbox drop-in renderer/editor. My query returns two columns: name [varchar(45)] and featured [smallint]. Featured returns either 1 or 0. Now, in the dataGrid, my featured column looks like this: First off... The checkbox doesn't show checked/unchecked according to the value of featured (1 or 0). Do I need to somehow convert 1 & 0 to boolean values? Isn't flash supposed to do this automatically? Secondly... The checkbox isn't centered. I'm not sure how to do that, as silly as it sounds. Shan --No virus found in this outgoing message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 -- Jason --No virus found in this incoming message.Checked by AVG Free Edition.Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006 __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.0/388 - Release Date: 7/13/2006