Yes, you define a static public var allowEdit:Boolean; in your item renderer. that variable will be a member of the class, rather then a member of a specific instance. Only a single copy of allowEdit exists, regardless of how many instances of your renderer you have.

Thus, you can get/modify it's value by referring to it using the class name:

MyRendererName.allowEdit=true;

Note, MyRenderName is the class name, not a specific instance!

Once your user logs in, you can set the allowEedit value:

if (username=="pete") MyRendererName.allowEdit=true;

inside your renderer, you can refer to the allowEdit property just as if it was a class member.


Tibor.

www.tiborballai.com





criptopus wrote:
My item renderer is as follows:-

===================================code
<?xml version="1.0" encoding="utf-8"?>
<!-- itemRenderer for foldEdit -->
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>" horizontalAlign="center">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;

public var retValue:String;

override public function set data(value:Object):void
{
if (value != null)
{
super.data=value;

if (value.shastatus == "E")
shared.selected=true;
else
shared.selected=false;
}
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
}

private function change():void
{
if (shared.selected == true)
retValue="E"
else
retValue="D";
}
]]>
</mx:Script>
<mx:CheckBox id="shared" change="change();"/>
</mx:HBox>
===================================code

So are you saying I set up a:: Static Public var allowEdit:Boolian; :: in here and how do I define it from the Datagrid, do I have to include it and set an instance up of it, that doesn't sound right to me. - I'm only a beginner any code hints would be great.



Reply via email to