[flexcoders] DataGrid With CheckBox ItemRenderer
Hi I'm hoping this is simple and I have done something silly. I have a datagrid with an itemrenderer which is a CheckBox and I have written the code below to deal with it. You will see some references to custom events that I have written as well. When I use it, the datagrid no longer updates on rollover and I can't work out why. All that happens is it highlights the first row you rollover and then stops. Any ideas anyone ? Thanks Chris package Components.Renderers { import Events.ColumnFilterEvent; import Events.InitiativeFilterEvent; import Events.IssueFilterEvent; import Model.LandscapeModelLocator; import flash.events.MouseEvent; import mx.controls.CheckBox; import mx.controls.DataGrid; public class CenteredCheckBoxHeaderRenderer extends CheckBox { private var modelLocator:LandscapeModelLocator = LandscapeModelLocator.getInstance(); public function CenteredCheckBoxHeaderRenderer() { super(); } override public function set data(value:Object):void { var pName:String = String (this.parent.parent); var myDG:DataGrid = listData.owner as DataGrid; switch(myDG.id) { case (InGrid): if (value.InVisible == 1) { selected = true; } else { selected = false; } break; case (IsGrid): if (value.IsVisible == 1) { selected = true; } else { selected = false; } break; case (CoGrid): if (value.CoVisible == 1) { selected = true; } else { selected = false; } break; default: break; } } override protected function clickHandler (event:MouseEvent):void { var myDG:DataGrid = listData.owner as DataGrid; super.clickHandler(event); switch(myDG.id) { case InGrid: var initiativeFilterEvent:InitiativeFilterEvent = new InitiativeFilterEvent((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(initiativeFilterEvent); break; case IsGrid: var issueFilterEvent:IssueFilterEvent = new IssueFilterEvent ((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(issueFilterEvent); break; case CoGrid: var columnFilterEvent:ColumnFilterEvent = new ColumnFilterEvent ((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(columnFilterEvent); break; default: break; } } } }
[flexcoders] DataGrid With CheckBox ItemRenderer
Hi I'm hoping this is simple and I have done something silly. I have a datagrid with an itemrenderer which is a CheckBox and I have written the code below to deal with it. You will see some references to custom events that I have written as well. When I use it, the datagrid no longer updates on rollover and I can't work out why. All that happens is it highlights the first row you rollover and then stops. Any ideas anyone ? Thanks Chris package Components.Renderers { import Events.ColumnFilterEvent; import Events.InitiativeFilterEvent; import Events.IssueFilterEvent; import Model.LandscapeModelLocator; import flash.events.MouseEvent; import mx.controls.CheckBox; import mx.controls.DataGrid; public class CenteredCheckBoxHeaderRenderer extends CheckBox { private var modelLocator:LandscapeModelLocator = LandscapeModelLocator.getInstance(); public function CenteredCheckBoxHeaderRenderer() { super(); } override public function set data(value:Object):void { var pName:String = String (this.parent.parent); var myDG:DataGrid = listData.owner as DataGrid; switch(myDG.id) { case (InGrid): if (value.InVisible == 1) { selected = true; } else { selected = false; } break; case (IsGrid): if (value.IsVisible == 1) { selected = true; } else { selected = false; } break; case (CoGrid): if (value.CoVisible == 1) { selected = true; } else { selected = false; } break; default: break; } } override protected function clickHandler (event:MouseEvent):void { var myDG:DataGrid = listData.owner as DataGrid; super.clickHandler(event); switch(myDG.id) { case InGrid: var initiativeFilterEvent:InitiativeFilterEvent = new InitiativeFilterEvent((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(initiativeFilterEvent); break; case IsGrid: var issueFilterEvent:IssueFilterEvent = new IssueFilterEvent ((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(issueFilterEvent); break; case CoGrid: var columnFilterEvent:ColumnFilterEvent = new ColumnFilterEvent ((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(columnFilterEvent); break; default: break; } } } }
RE: [flexcoders] DataGrid With CheckBox ItemRenderer
Hard to tell from that code. Are you working from an example on my blog (blogs.adobe.com/aharui) or FlexExamples? From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of chris.cobb40 Sent: Wednesday, January 07, 2009 9:42 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid With CheckBox ItemRenderer Hi I'm hoping this is simple and I have done something silly. I have a datagrid with an itemrenderer which is a CheckBox and I have written the code below to deal with it. You will see some references to custom events that I have written as well. When I use it, the datagrid no longer updates on rollover and I can't work out why. All that happens is it highlights the first row you rollover and then stops. Any ideas anyone ? Thanks Chris package Components.Renderers { import Events.ColumnFilterEvent; import Events.InitiativeFilterEvent; import Events.IssueFilterEvent; import Model.LandscapeModelLocator; import flash.events.MouseEvent; import mx.controls.CheckBox; import mx.controls.DataGrid; public class CenteredCheckBoxHeaderRenderer extends CheckBox { private var modelLocator:LandscapeModelLocator = LandscapeModelLocator.getInstance(); public function CenteredCheckBoxHeaderRenderer() { super(); } override public function set data(value:Object):void { var pName:String = String (this.parent.parent); var myDG:DataGrid = listData.owner as DataGrid; switch(myDG.id) { case (InGrid): if (value.InVisible == 1) { selected = true; } else { selected = false; } break; case (IsGrid): if (value.IsVisible == 1) { selected = true; } else { selected = false; } break; case (CoGrid): if (value.CoVisible == 1) { selected = true; } else { selected = false; } break; default: break; } } override protected function clickHandler (event:MouseEvent):void { var myDG:DataGrid = listData.owner as DataGrid; super.clickHandler(event); switch(myDG.id) { case InGrid: var initiativeFilterEvent:InitiativeFilterEvent = new InitiativeFilterEvent((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(initiativeFilterEvent); break; case IsGrid: var issueFilterEvent:IssueFilterEvent = new IssueFilterEvent ((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(issueFilterEvent); break; case CoGrid: var columnFilterEvent:ColumnFilterEvent = new ColumnFilterEvent ((listData.rowIndex + myDG.verticalScrollPosition) as Number, this.selected as Boolean); dispatchEvent(columnFilterEvent); break; default: break; } } } }
[flexcoders] dataGrid and checkBox
*what is the best way to add a checkbox field to each row of a datagrid and read what is checked ? I really need this for my project.*
[flexcoders] datagrid with checkbox implementation
Hi All, Hi in my application am using datagrid in that am using dataprovider for displaying the data the data has been retrieving using remote object. am using the check box within itemrenderer. mx:DataGridColumn id=column4 textAlign=center headerText=Multi width=100 dataField=multi mx:itemRenderer mx:Component mx:CheckBox selected={data.multi}/ /mx:Component /mx:itemRenderer /mx:DataGridColumn by using the above code all the checkboxes are selected. But when getting the data from remote object I have some true and false values these values are reflected on comboBox. When it is true then checkbox is checked otherwise not selected. How to use the functionality for that. can anyone help me how to achieve this. --tomt.
RE: [flexcoders] datagrid with checkbox implementation
Try: mx:DataGridColumn id=column4 textAlign=center headerText=Multi width=100 dataField=multi mx:itemRenderer mx:Component mx:CheckBox / /mx:Component /mx:itemRenderer /mx:DataGridColumn From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tom Preet Sent: Tuesday, March 04, 2008 1:03 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] datagrid with checkbox implementation Hi All, Hi in my application am using datagrid in that am using dataprovider for displaying the data the data has been retrieving using remote object. am using the check box within itemrenderer. mx:DataGridColumn id=column4 textAlign=center headerText=Multi width=100 dataField=multi mx:itemRenderer mx:Component mx:CheckBox selected={data.multi}/ /mx:Component /mx:itemRenderer /mx:DataGridColumn by using the above code all the checkboxes are selected. But when getting the data from remote object I have some true and false values these values are reflected on comboBox. When it is true then checkbox is checked otherwise not selected. How to use the functionality for that. can anyone help me how to achieve this. --tomt.
Re: [flexcoders] datagrid with checkbox implementation
Hi, Thanks for the reply. Checkbox was displaying in the page. but it was not selected from remote object some values are true and some values are false. for true it was selected but here just check box was displaying by using the above code. can I have to declare function for that if true then selected like that. give me some suggestions. Thanks, Tomt On 3/4/08, Alex Harui [EMAIL PROTECTED] wrote: Try: mx:DataGridColumn id=column4 textAlign=center headerText=Multi width=100 dataField=multi mx:itemRenderer mx:Component mx:CheckBox / /mx:Component /mx:itemRenderer /mx:DataGridColumn -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Tom Preet *Sent:* Tuesday, March 04, 2008 1:03 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] datagrid with checkbox implementation Hi All, Hi in my application am using datagrid in that am using dataprovider for displaying the data the data has been retrieving using remote object. am using the check box within itemrenderer. mx:DataGridColumn id=column4 textAlign=center headerText=Multi width=100 dataField=multi mx:itemRenderer mx:Component mx:CheckBox selected={data.multi}/ /mx:Component /mx:itemRenderer /mx:DataGridColumn by using the above code all the checkboxes are selected. But when getting the data from remote object I have some true and false values these values are reflected on comboBox. When it is true then checkbox is checked otherwise not selected. How to use the functionality for that. can anyone help me how to achieve this. --tomt.
RE: [flexcoders] datagrid with checkbox implementation
A CheckBox, when used as an item renderer in a DataGrid, looks at the dataField from the object to determine whether to display the checkbox. If your data is XML, or the field is not a Boolean, then you might have to do more work. Maybe you should post a test case so we can understand what is going on. Instead of using RemoteObject, just assign a new ArrayCollection of data. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tom Preet Sent: Tuesday, March 04, 2008 8:57 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] datagrid with checkbox implementation Hi, Thanks for the reply. Checkbox was displaying in the page. but it was not selected from remote object some values are true and some values are false. for true it was selected but here just check box was displaying by using the above code. can I have to declare function for that if true then selected like that. give me some suggestions. Thanks, Tomt On 3/4/08, Alex Harui [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Try: mx:DataGridColumn id=column4 textAlign=center headerText=Multi width=100 dataField=multi mx:itemRenderer mx:Component mx:CheckBox / /mx:Component /mx:itemRenderer /mx:DataGridColumn From: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Tom Preet Sent: Tuesday, March 04, 2008 1:03 AM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com Subject: [flexcoders] datagrid with checkbox implementation Hi All, Hi in my application am using datagrid in that am using dataprovider for displaying the data the data has been retrieving using remote object. am using the check box within itemrenderer. mx:DataGridColumn id=column4 textAlign=center headerText=Multi width=100 dataField=multi mx:itemRenderer mx:Component mx:CheckBox selected={data.multi}/ /mx:Component /mx:itemRenderer /mx:DataGridColumn by using the above code all the checkboxes are selected. But when getting the data from remote object I have some true and false values these values are reflected on comboBox. When it is true then checkbox is checked otherwise not selected. How to use the functionality for that. can anyone help me how to achieve this. --tomt.