[flexcoders] Re: Date Fields and Data Binding.
Well I am not sure I understand your meaning sorry. When the selectedObject instance on the model has a date member variable that is blank, the field starts blank, but once the the field changes, but not the instance, that text never leaves the date field. It does it however when I use text or label boxes that have null string member variables. So I dont understand why the date field is working so differently. Jeremy --- In flexcoders@yahoogroups.com, Steve Hindle [EMAIL PROTECTED] wrote: Just a guess here - I just use vanilla Flex Sounds like the field is not being assigned. Since the field starts out as blank in your model, and your selecting another model with a blank field - perhaps Flex is 'short-circuiting' the assignment. I've noticed that for an assignment like foo = bar, Flex always seems to call the getter for foo, _before_ calling the setter. I can only surmise this it to allow it to short circuit the assignment if foo = bar already. So in your case, blank == blank, and no assignment is done, hence no event fires ? On 12/6/06, jsscardinal [EMAIL PROTECTED] wrote: I am attempting to do something I thought was pretty simple. Using the cairngorm model, basically I have a data instance object attached to the model, and it has a Data Object attached to it. So think of it this way. I am running an application that tracks a list of canidates. So there is a CanidateVO actionscript object, and it has a member variable attached to it called interview date, and its of type Date. I am running a java backend retrieving these using spring and hybernate, and the conversion works fine. The problem I am having is with data binding in a grid and details panel. The grid has an array collection which is attached to the model, and that array contains a list of all the canidates, some that have dates and some that dont. All have member variables, but since all instances have not interviewed they may not have a value in the date field, thus those member vars are null. So the problem is that when I have a particular grid object selected, I see the details of that canidate in the details panel, which is just a panel that contains text fields and a dateField component. Well all the other bindings are working fine, but not the dateField binding. I have set the dateFields text bound to the attribute of the object, and that does not work, and I have set the dataProvider and that does not work, and I have even set a data attribute on the dateField and that does not work. Whats happening is, when I am looking at a particular canidate without an interview date, and I select the dateField, then put a date in it and DONT save the record but go to a different instance on the grid, all the fields are updated except the dateField. The dateField text remains there regardless of the fact that the selectedItem has changed, and the new selectedItem has no date in it. Conversly if I select a canidate who does have a date, the date is displayed, but once I go to one without a date, the date stays in the field. Why is data binding not working for dates? Please help. Jeremy.
[flexcoders] Re: Dot notation to access objects inside a datagrid column
I encountered this same thing before. The solution is to use a labelfunction. Like this: Here is the grid column. mx:DataGridColumn headerText=Port Country labelFunction=myLabelFunction / Here is the function which should reside inside the Script tag: private function myLabelFunction(item:Object, col:DataGridColumn) : String { return item.userGroup.name; } Give this a try. Jeremy Sanders Cardinal Solutions Group. [EMAIL PROTECTED] --- In flexcoders@yahoogroups.com, Niko Schmuck [EMAIL PROTECTED] wrote: Hi FlexCoders: Coming from a Java background, I was surprised that the dot operator is not working as I expected. The array with the data structure and children is populated from the (Hibernate) data source at creationComplete time with: ds.fill(users, all.users, []); The array collection is declared via: mx:ArrayCollection id=users / and then used inside the datagrid ... mx:DataGrid id=dgrid dataProvider={users} editable=false mx:columns mx:DataGridColumn headerText=User ID dataField=id/ mx:DataGridColumn headerText=First Name dataField=firstName/ mx:DataGridColumn headerText=Last Name dataField=lastName/ mx:DataGridColumn headerText=Group dataField=userGroup.name/ /mx:columns /mx:DataGrid Unfortunately the dot-access to the related user group name seems not to work, there is just nothing being displayed. If dataField=userGroup then there is [object UserGroup] displayed inside the datagrid column. So how do you retrieve the properties of the related user group object? Thanks for your help, Niko PS: The classes for value objects look very straight-forward: // User.as package com.example.flex { [Managed] [RemoteClass(alias=com.example.flex.User)] public class User { public var id:Number; public var firstName:String = ; public var lastName:String = ; public var userGroup:UserGroup; public function User() { } } } // UserGroup.as package com.example.flex { [Managed] [RemoteClass(alias=com.example.flex.UserGroup)] public class UserGroup { public var id:Number; public var name:String = ; public function UserGroup() { } } }
[flexcoders] Date Fields and Data Binding.
I am attempting to do something I thought was pretty simple. Using the cairngorm model, basically I have a data instance object attached to the model, and it has a Data Object attached to it. So think of it this way. I am running an application that tracks a list of canidates. So there is a CanidateVO actionscript object, and it has a member variable attached to it called interview date, and its of type Date. I am running a java backend retrieving these using spring and hybernate, and the conversion works fine. The problem I am having is with data binding in a grid and details panel. The grid has an array collection which is attached to the model, and that array contains a list of all the canidates, some that have dates and some that dont. All have member variables, but since all instances have not interviewed they may not have a value in the date field, thus those member vars are null. So the problem is that when I have a particular grid object selected, I see the details of that canidate in the details panel, which is just a panel that contains text fields and a dateField component. Well all the other bindings are working fine, but not the dateField binding. I have set the dateFields text bound to the attribute of the object, and that does not work, and I have set the dataProvider and that does not work, and I have even set a data attribute on the dateField and that does not work. Whats happening is, when I am looking at a particular canidate without an interview date, and I select the dateField, then put a date in it and DONT save the record but go to a different instance on the grid, all the fields are updated except the dateField. The dateField text remains there regardless of the fact that the selectedItem has changed, and the new selectedItem has no date in it. Conversly if I select a canidate who does have a date, the date is displayed, but once I go to one without a date, the date stays in the field. Why is data binding not working for dates? Please help. Jeremy.