7月 132012
 
Pocket

症状
  1. EditableなDataGridを用意する
  2. あるセルのテキストを選択状態にする
  3. グリッドをスクロールする(マウスホイールが分かりやすい)
  4. 関係のないセルにテキスト選択の黒枠が残る
原因

このバグ↓っぽい
[#SDK-11236] If you select text in a DataGrid and then scroll down, various rows in the new views have the same text selections – Adobe Bug System

指摘されているバージョンはFlex3のベータ版。
これはFlashPlayerのバグで、回避コードを書くことは可能だが、Flexでは対処を保留すると書かれている気がする。。

対処方法

とりあえずDataGridのfocusOutイベントで、セルに対してsetSelection(0, 0)とする事で対処できる。
もっといい方法やタイミングもあるかも。
[js]
public function DataGrid():void{
super();
addEventListener(FocusEvent.FOCUS_OUT, onFocusOutEnd, false, -10);
}

private function onFocusOutEnd(event:Event):void{
if(event.target is TextField){
//バブリングで処理。itemFocusOutでもいいかも。
TextField(event.target).setSelection(0,0);
}
}
[/js]

 Leave a Reply