I commented out all of the bindings and ran teh code again, I got the 
same error.

so I took out the change event function : viewSelectedProfile() then 
the error stopped.

Here is the datagrid code:
<mx:DataGrid id="dgUserList" width="100%" height="100%" 
headerStyleName="normalTenBold" 
dataProvider="{userListDP}" initialize="test(event)"
change="viewSelectedProfile(event                       
        <mx:columns>
        <mx:DataGridColumn id="dgcStatus" headerText="Status" 
dataField="isActive" width="50"/>
        <mx:DataGridColumn id="dgcLastName" headerText="Last Name" 
dataField="user_lname" width="100"/>
        <mx:DataGridColumn id="dgcFirstName" headerText="First Name" 
dataField="user_fname" width="100"/>
        <mx:DataGridColumn id="dgcPhone" headerText="Phone" 
dataField="user_phone" width="100"/>                            
        
        <mx:DataGridColumn id="dgcEmail" headerText="Email" 
dataField="user_email"  width="200" />                          
        
        <mx:DataGridColumn id="dgcRoles" visible="true" 
headerText="Roles" dataField="roles"  width="200" 
itemRenderer="com.sync.view.community.RolesList" />
                                </mx:columns>
</mx:DataGrid>


change event function:
private function viewSelectedProfile(e:Event):void {
        this.currentState = 'viewSelected';
        //trace(e.currentTarget.selectedItem.roles);
}


Any ideas why this is throwing a mouseHandler datagrid error?  it has 
something to do with the viewstate being changed again bc the error 
doesnt throw when i comment out this.currentState = 'viewSelected'


--- In [email protected], "gotjosh819i" <[EMAIL PROTECTED]> 
wrote:
>
> Hello all,  I am stuck on an issue and have run out of ideas to 
debug 
> it. (see below)
> 
> I am having an issue with a binding.  I have a datagrid and the 
> onchange event triggers the viewstate to change and some 
> labels/images appear, some of which have data bindings to the 
> datagrid selection.
> 
> I think the problem is that those label/image components within the 
> view are not initialized and the error is thrown since the data 
> binding doesnt know those items exist, even though the 
creationPolicy 
> is set to all at the top level. (the mxml file that has the 
viewstate 
> in it).
> 
> Since its not being initialized I get this error each time I click 
on 
> a datagrid row.
> 
> TypeError: Error #1009: Cannot access a property or method of a 
null 
> object reference.
>       at mx.controls::DataGrid/mx.controls:DataGrid::mouseUpHandler
> ()[C:\dev\flex_201_gmc\sdk\frameworks\mx\controls\DataGrid.as:4218]
> 
> I am positive those items are not being init'd bc i put a 
initialize 
> test function that traces the components when they are initialized 
> just to see if the error is occuring after they are initialized or 
> before they are.  This is happening before and the item never gets 
> init'd.
> 
> private function test(e:Event):void {
>       trace("item init: " + e.currentTarget);
> }
> 
> one of the items hidden in a viewstate:
> <mx:HBox>
>                                                       
>       <mx:Label styleName="normalTenBold" text="Status:" width="75" 
> textAlign="right"/>
>                                                               
>       <mx:Image source="{(dgUserList.selectedItem.isActive)?
> iconStatusOn:iconStatusOff}"  width="19" height="20" 
initialize="test
> (event)"/>                                                    
>               
> </mx:HBox>    
> 
> 
> The odd thing is that the canvas which is just before the HBox 
above, 
> is being init'd, then the error occurs and the image component 
doesnt 
> init.
> 
> last thing: the error in the debugger pulls up DataGrid.as and 
points 
> to line 4217:
> 
>   if (headerVisible)
>                 pos.y--;
> 
> 
> any ideas on how to get past this issue?  
> 
> - thanks in advance ~ Josh
>


Reply via email to