我有一个带有ItemRenderer和ItemEditor的数据网格。 点击,因为我的数据网格是可编辑的,我可以修改编辑单元格的值。 但是,当我使用tab键验证这些更改时,例如,itemrender值与开头时相同,不会出现任何更改。
你能解释一下如何解决这个问题吗?
<mx:DataGridColumn dataField="scRub2" headerText="{sNomCol2}"
editable="true" width="{iNomCol2}"id="dgc1" wordWrap="true"
itemRenderer="itemRenderer.MultilineHTMLRenderer"
itemEditor="itemRenderer.irHtmlText"
editorDataField="htmlModif"
// itemEditor
<?xml version="1.0" encoding="utf-8"?>
<fx:Script>
<![CDATA[
public var htmlModif:String;
protected function lblData_changeHandler(event:Event):void
{
htmlModif = lblData.htmlText;
}
]]>
</fx:Script>
<mx:TextArea id="lblData" top="0" left="0" right="0" bottom="0"
htmlText="{dataGridListData.label}" preinitialize="initTA()"
change="lblData_changeHandler(event)">
<fx:Script>
<![CDATA[
import flash.events.Event;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
[Bindable("dataChange")] private var _listData : BaseListData;
override public function get listData():BaseListData
{
return _listData;
}
override public function set listData( value : BaseListData ) : void
{
_listData = value;
}
private function onChange(event:Event):void
{
this.data[ (listData as DataGridListData).dataField ] = lblData.htmlText;
}
public function initTA():void {
addEventListener("dataChange", handleDataChanged);
}
public function handleDataChanged(event:Event):void {
// Cast listData to DataGridListData.
var myListData:DataGridListData =
DataGridListData(listData);
// Access information about the data passed
// to the cell renderer.
trace("row index: " + String(myListData.rowIndex) +
" column index: " + String(myListData.columnIndex));
}
]]>
</fx:Script>
</mx:TextArea>
由于
答案 0 :(得分:0)
我没有运行您的代码,但认为将字段 htmlModif 更改为获取功能将解决您的问题
public var htmlModif:String;
protected function lblData_changeHandler(event:Event):void
{
htmlModif = lblData.htmlText;
}
到
public function get htmlModif():String
{
return lblData.htmlText;
}
希望有所帮助