RE: [flexcoders] Re: Center Checkbox in DG Column
Yes, see the other item renderer posts on my blog From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of markgoldin_2000 Sent: Monday, November 03, 2008 5:05 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column Yes, that works, thanks. The only thing I dont understand, if I trace value I am getting as many rows as many rows visible in the DG at one time. Is that right? --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: Why are you using the label property? That property is not on your item object. You should do something like this: super.data = value; var xmlData:XML = XML(value); trace(xmlData.Includeintoreport.text()) selected = (xmlData.Includeintoreport.text() == true ? true: false); Tracy From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] On Behalf Of markgoldin_2000 Sent: Saturday, November 01, 2008 7:07 AM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column I even changed it to this: selected = ( selected == false ? true: false); When I click on a checkbox then all visible rows in the DG get checkbox checked except the one I have clicked on. Also with trace here: override public function set data(value:Object):void { if(value != null) { super.data = value; trace(value); selected = ( value.label == true ? true: false); } It shows data that correspondents to all visible on the screen grid's rows. Dont know if that's right. --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders% 40yahoogroups.com , Alex Harui aharui@ wrote: Maybe: override public function set data(value:Object):void { if(value != null) { super.data = value; selected = ( value.label == true ? true: false); } From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders% 40yahoogroups.com ] On Behalf Of markgoldin_2000 Sent: Friday, October 31, 2008 3:35 PM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders% 40yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column I dont know what I am missing, but still not working for me. Here is my code: import flash.events.Event; import mx.controls.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.listClasses.IDropInListItemRenderer; public class checkBoxGrid extends CheckBox implements IDropInListItemRenderer { public function checkBoxGrid() { super(); addEventListener(change, onClick); } override public function set data(value:Object):void { if(value != null) { super.data = value; selected = value.label; } } //called by click of the checkbox private function onClick(e:Event):void { var dataFieldName:String = DataGrid (listData.owner).columns[listData.columnIndex].dataField; data[dataFieldName] = String (selected); //set the checkbox state into the dataProvider } } mxml implementation: mx:DataGridColumn headerText=Include into Report dataField=includeintoreport width=40 textAlign=center mx:itemRenderer mx:Component modulecode:checkBoxGrid/ /mx:Component /mx:itemRenderer /mx:DataGridColumn Data sample: Fragment vendors ccompany A. FEIBUSCH CORP. /ccompany includeintoreport false /includeintoreport cvendno ZIPPER /cvendno /vendors When I run it all chckboxes come checked despite false in includeintoreport field. So, when I click on a checkbox nothing is changed, it keeps checked status. Hope, someone can help. --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com, Alex Harui aharui@ wrote: Also see: http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.h http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende. h tml From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders% 40yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of markgoldin_2000 Sent: Friday, October 31, 2008 1:50 PM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column You could also potentially use my extended datagrid Where can I find it? --- In flexcoders
RE: [flexcoders] Re: Center Checkbox in DG Column
Why are you using the label property? That property is not on your item object. You should do something like this: super.data = value; var xmlData:XML = XML(value); trace(xmlData.Includeintoreport.text()) selected = (xmlData.Includeintoreport.text() == true ? true: false); Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of markgoldin_2000 Sent: Saturday, November 01, 2008 7:07 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column I even changed it to this: selected = ( selected == false ? true: false); When I click on a checkbox then all visible rows in the DG get checkbox checked except the one I have clicked on. Also with trace here: override public function set data(value:Object):void { if(value != null) { super.data = value; trace(value); selected = ( value.label == true ? true: false); } It shows data that correspondents to all visible on the screen grid's rows. Dont know if that's right. --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex Harui [EMAIL PROTECTED] wrote: Maybe: override public function set data(value:Object):void { if(value != null) { super.data = value; selected = ( value.label == true ? true: false); } From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of markgoldin_2000 Sent: Friday, October 31, 2008 3:35 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column I dont know what I am missing, but still not working for me. Here is my code: import flash.events.Event; import mx.controls.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.listClasses.IDropInListItemRenderer; public class checkBoxGrid extends CheckBox implements IDropInListItemRenderer { public function checkBoxGrid() { super(); addEventListener(change, onClick); } override public function set data(value:Object):void { if(value != null) { super.data = value; selected = value.label; } } //called by click of the checkbox private function onClick(e:Event):void { var dataFieldName:String = DataGrid (listData.owner).columns[listData.columnIndex].dataField; data[dataFieldName] = String (selected); //set the checkbox state into the dataProvider } } mxml implementation: mx:DataGridColumn headerText=Include into Report dataField=includeintoreport width=40 textAlign=center mx:itemRenderer mx:Component modulecode:checkBoxGrid/ /mx:Component /mx:itemRenderer /mx:DataGridColumn Data sample: Fragment vendors ccompany A. FEIBUSCH CORP. /ccompany includeintoreport false /includeintoreport cvendno ZIPPER /cvendno /vendors When I run it all chckboxes come checked despite false in includeintoreport field. So, when I click on a checkbox nothing is changed, it keeps checked status. Hope, someone can help. --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com, Alex Harui aharui@ wrote: Also see: http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.h http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.h tml From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of markgoldin_2000 Sent: Friday, October 31, 2008 1:50 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column You could also potentially use my extended datagrid Where can I find it? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.commailto :flexcoders% 40yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.commailto :flexcoders% 40yahoogroups.com, markgoldin_2000 markgoldin_2000@ wrote: I am trying to get a checkbox working properly in my DG column when it's placed in a HBox in order to center the checkbox. I am overriding a few functions in the checkbox but none of them gets any hit. Do I need also override something in the HBox container? You might find this useful: http://www.returnundefined.com/2006/11/creating-truly-reusable- http://www.returnundefined.com/2006/11/creating-truly-reusable- renderers-with-classfactory You could also potentially use my extended datagrid to set the verticalCenter and horizontalCenter on the checkboxes to 0. In that case, you could simply use a CheckBox as the itemRenderer. Or, if you're only using CheckBoxes in that one
RE: [flexcoders] Re: Center Checkbox in DG Column
Also see: http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.html From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of markgoldin_2000 Sent: Friday, October 31, 2008 1:50 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column You could also potentially use my extended datagrid Where can I find it? --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, markgoldin_2000 markgoldin_2000@ wrote: I am trying to get a checkbox working properly in my DG column when it's placed in a HBox in order to center the checkbox. I am overriding a few functions in the checkbox but none of them gets any hit. Do I need also override something in the HBox container? You might find this useful: http://www.returnundefined.com/2006/11/creating-truly-reusable- renderers-with-classfactory You could also potentially use my extended datagrid to set the verticalCenter and horizontalCenter on the checkboxes to 0. In that case, you could simply use a CheckBox as the itemRenderer. Or, if you're only using CheckBoxes in that one place, you could just use a CheckBox TypeSelector to set the horizontalCenter and verticalCenter styles. HTH; Amy
RE: [flexcoders] Re: Center Checkbox in DG Column
Maybe: override public function set data(value:Object):void { if(value != null) { super.data = value; selected = ( value.label == true ? true: false); } From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of markgoldin_2000 Sent: Friday, October 31, 2008 3:35 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column I dont know what I am missing, but still not working for me. Here is my code: import flash.events.Event; import mx.controls.*; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.listClasses.IDropInListItemRenderer; public class checkBoxGrid extends CheckBox implements IDropInListItemRenderer { public function checkBoxGrid() { super(); addEventListener(change, onClick); } override public function set data(value:Object):void { if(value != null) { super.data = value; selected = value.label; } } //called by click of the checkbox private function onClick(e:Event):void { var dataFieldName:String = DataGrid (listData.owner).columns[listData.columnIndex].dataField; data[dataFieldName] = String (selected); //set the checkbox state into the dataProvider } } mxml implementation: mx:DataGridColumn headerText=Include into Report dataField=includeintoreport width=40 textAlign=center mx:itemRenderer mx:Component modulecode:checkBoxGrid/ /mx:Component /mx:itemRenderer /mx:DataGridColumn Data sample: Fragment vendors ccompany A. FEIBUSCH CORP. /ccompany includeintoreport false /includeintoreport cvendno ZIPPER /cvendno /vendors When I run it all chckboxes come checked despite false in includeintoreport field. So, when I click on a checkbox nothing is changed, it keeps checked status. Hope, someone can help. --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Also see: http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.h tml From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] On Behalf Of markgoldin_2000 Sent: Friday, October 31, 2008 1:50 PM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Center Checkbox in DG Column You could also potentially use my extended datagrid Where can I find it? --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.commailto:flexcoders% 40yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.commailto:flexcoders% 40yahoogroups.com, markgoldin_2000 markgoldin_2000@ wrote: I am trying to get a checkbox working properly in my DG column when it's placed in a HBox in order to center the checkbox. I am overriding a few functions in the checkbox but none of them gets any hit. Do I need also override something in the HBox container? You might find this useful: http://www.returnundefined.com/2006/11/creating-truly-reusable- renderers-with-classfactory You could also potentially use my extended datagrid to set the verticalCenter and horizontalCenter on the checkboxes to 0. In that case, you could simply use a CheckBox as the itemRenderer. Or, if you're only using CheckBoxes in that one place, you could just use a CheckBox TypeSelector to set the horizontalCenter and verticalCenter styles. HTH; Amy