- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi,
here is the small app i wrote using your example. In the
DataGridColumn's dataField function, even though the dataField is
there, in the label it doesn't show up if we assign such complex
objects directly through dataField. So, you can use labelFunction
(callback function) to show like what i did below for any label you
want to show for customFields.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" xmlns:rtc="AfcsNameSpace" >
<mx:Script>
<![CDATA[
import com.adobe.rtc.sharedManagers.UserManager;
private var _userManager:UserManager ;
public function onCreationComplete():void
{
_userManager = cSession.userManager ;
if (!_userManager.isCustomFieldDefined('score')) {
_userManager.registerCustomUserField('score');
}
_userManager.setCustomUserField(_userManager.myUserID,'score','7');
}
private function
scoreLabelFunction(item:Object,column:DataGridColumn):String
{
return item.customFields['score'] ;
}
]]>
</mx:Script>
<rtc:ConnectSessionContainer id="cSession" roomURL="Your
Room Url">
<rtc:authenticator>
<rtc:AdobeHSAuthenticator userName="Your UserName"
password="Your Password" />
</rtc:authenticator>
<mx:DataGrid id="datag"
dataProvider="{cSession.userManager.userCollection}"
creationComplete="onCreationComplete()" >
<mx:columns>
<mx:DataGridColumn id="c1" headerText="Name"
dataField="displayName" />
<mx:DataGridColumn id="c2" headerText="Score"
dataField="customFields['score']"
labelFunction="scoreLabelFunction" />
</mx:columns>
</mx:DataGrid>
</rtc:ConnectSessionContainer>
</mx:Application>
Thanks
Hironmay Basu
here is the small app i wrote using your example. In the
DataGridColumn's dataField function, even though the dataField is
there, in the label it doesn't show up if we assign such complex
objects directly through dataField. So, you can use labelFunction
(callback function) to show like what i did below for any label you
want to show for customFields.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" xmlns:rtc="AfcsNameSpace" >
<mx:Script>
<![CDATA[
import com.adobe.rtc.sharedManagers.UserManager;
private var _userManager:UserManager ;
public function onCreationComplete():void
{
_userManager = cSession.userManager ;
if (!_userManager.isCustomFieldDefined('score')) {
_userManager.registerCustomUserField('score');
}
_userManager.setCustomUserField(_userManager.myUserID,'score','7');
}
private function
scoreLabelFunction(item:Object,column:DataGridColumn):String
{
return item.customFields['score'] ;
}
]]>
</mx:Script>
<rtc:ConnectSessionContainer id="cSession" roomURL="Your
Room Url">
<rtc:authenticator>
<rtc:AdobeHSAuthenticator userName="Your UserName"
password="Your Password" />
</rtc:authenticator>
<mx:DataGrid id="datag"
dataProvider="{cSession.userManager.userCollection}"
creationComplete="onCreationComplete()" >
<mx:columns>
<mx:DataGridColumn id="c1" headerText="Name"
dataField="displayName" />
<mx:DataGridColumn id="c2" headerText="Score"
dataField="customFields['score']"
labelFunction="scoreLabelFunction" />
</mx:columns>
</mx:DataGrid>
</rtc:ConnectSessionContainer>
</mx:Application>
Thanks
Hironmay Basu
Views
Replies
0 Likes
Total Likes