作成日: 2026/01/27 最終更新日: 2026/05/13
文書種別
不具合
状況
修正済み
詳細
FlexGridのカスタムエディタに設定されたAutoCompleteで、itemsSourceに同じ文字列で始まる複数のアイテムがある場合、グリッドが編集モードに入るときにアイテムのデフォルト選択が変わる可能性があります。それまで選択されていたアイテムではなく、前方一致する最初のアイテムが選択されてしまいます。
回避方法
この問題はバージョン5.20261.50で修正されました。
修正版を適用しない場合の回避方法は次の通りです。
以下のようにグリッドのprepareCellForEditイベントを処理して、正しいアイテムを選択します。
grid.prepareCellForEdit.addHandler((s, e) => {
const col = e.getColumn();
if (col.editor && col.editor.selectedValuePath) {
const editor = col.editor;
const item = e.getRow().dataItem;
const rawValue = item[col.binding];
const idx = editor.collectionView?.sourceCollection.findIndex(
(obj) => obj[editor.selectedValuePath] === rawValue
);
if (idx > -1) {
editor.selectedIndex = idx;
}
}
});