问题描述:

One thing that I can make out is that set value gives you the value only for the given column as compared to the whole object.

But, when you edit this value, it just doesn't save it. I tried overriding save() method and returning true, but still I don't see my value updated. As soon as editor closes, value comes back to as it was before edit.

What could be the best use case for it and how it should be used?

Thanks.

<?xml version="1.0" encoding="utf-8"?>

<s:GridItemEditor xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx">

<fx:Declarations>

</fx:Declarations>

<fx:Script>

<![CDATA[

private var _data:Object;

private var _labelText:String = '';

private var bTextChanged:Boolean = false;

override public function set data(newVal:Object):void

{

super.data = newVal;

_data = newVal;

}

override public function get data():Object

{

return _data;

}

override public function set value(newValue:Object):void

{

_labelText = newValue as String;

}

override public function get value():Object

{

return labelTextInput.text;

}

override public function setFocus():void

{

labelTextInput.setFocus();

}

override public function save():Boolean

{

if(data.hasOwnProperty("action")) data.action = 'UI_UPDATED';

return true;

}

override protected function commitProperties():void

{

super.commitProperties();

if (bTextChanged)

{

bTextChanged = false;

labelTextInput.text = _labelText;

}

}

]]>

</fx:Script>

<s:TextInput id="labelTextInput" prompt="Enter Text" width="100%" height="100%"/>

</s:GridItemEditor>

相关阅读:
Top