I have a really odd issue with an ItemRenderer. I have a main.mxml container with a ViewStack. When a user logs in, the initial view contains an AdvancedDataGrid--containing some data and the ItemRenderer below--which simply displays a Delete button. When the user logs in, this AdvancedDataGrid is automatically refreshed from the database. The Delete button should be enabled or disabled based on the user's role membership.
Scenario 1 (Logging in as an admin):
- Admin user logs in -- datagrid view is immediately displayed and Delete button is properly enabled for every row
- Logout
- Login as a non-admin user -- Data is refreshed and all of the rows are still enabled except for one. It could be the first, second or third rows--it's completely random. It's really wierd . . .
I restart my browser and follow scenario 2 . . .
Scenario 2 (Logging in as an non-admin):
- Non-admin user logs in -- datagrid view is immediately displayed and Delete button is properly disabled for every row
- Logout
- Login as a admin user -- All of the rows are still disabled except for one. It could be the first, second or third rows--it's completely random. Just the reverse of the first scenario.
INTERESTING FACT-- If I put a breakpoint in checkDeleteSecurity, it reaches it ONLY WHEN THE FIRST USER LOGS IN AND THE DATAGRID IS FIRST REFRESHED. When I logout and the next user logs in, the data grid is refreshed, but the checkDeleteSecurity breakpoint is never caught.
[Bindable]
private function checkDeleteSecurity ():Boolean
{
return (SecurityProxy.CheckSecurity(SecurityProxy.UserName));
}
<mx:LinkButton label="Delete" click="onDeleteClick()" id="lbDelete" enabled="{checkDeleteSecurity()}"/>