You probably want to make that column non editable editable="false" and just put a handler on the click event... click="doSomething(event)".

hth
Scott

Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com



George wrote:

Hi guys,

My DataGrid is listening to itemEditEnd for each itemEditor change. I
have a ComboBox and a CheckBox used as itemEditor components in the
datagrid. I'm going to make immediate actions to user interaction, like
when change selection of a ComboBox, once user select another value,
application immediately make a request to server and continue something
upon response.

The ComboBox works well for me, when there's a 'close' event I simply
move focus out of that itemEditorInstance, itemEditEnd function
activated without problem.

But the CheckBox behavior is quite strange, when I click on it, if
checkbox.selected change to false, itemEditEnd function won't do
anything; but when click on and checkbox.selected=true, itemEditEnd
immediately get the event. I don't understand how CheckBox ate the
focusManager changes.

Source code followed, I tried different ways from simple CheckBox
component to custom component but no luck.

Any help appreciated.

Thanks,
George

---------------------------------------------------------
DataGrid component class:
<mx:DataGridColumn headerText="Enable" itemRenderer="EnableEdit"
rendererIsEditor="true" editorDataField="selected" dataField="enable"
width="50" sortable="false"/>

private function itemEditEndHandler(e:DataGridEvent):void
{
trace('get it?');
var grid:DataGrid = e.currentTarget as DataGrid;
var pos:Object = grid.editedItemPosition;
trace(pos.rowIndex);
// something to do
}

EnableEdit.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml>"
horizontalAlign="center" dataChange="this.update()"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.binding.utils.BindingUtils;

[Bindable]
public var selected:Boolean;

private function init():void
{
this.update();
//BindingUtils.bindProperty(this, 'check',
this.checkBox, 'selected');
}
private function update():void
{
this.selected = data.enable;
this.checkBox.selected = this.selected;
}
/*
public function set check(b:Boolean):void
{
if(this.selected != b){
trace('changed?');
this.selected = b;
//change focus will dispatch itemEditEnd event or
whatever.

RouterModelLocator.getInstance().application.mainView.setFocus();
}
}*/
private function clicked():void
{
trace('clicked');
//this.checkBox.setFocus();

TestModelLocator.getInstance().application.mainView.setFocus();
}
]]>
</mx:Script>
<mx:CheckBox id="checkBox" click="this.clicked()"/>
</mx:HBox>

Reply via email to