1

I have a CellList with SingleSelectionModel, My use case is:

  1. User selects one row(oldProxy) in CellList.
  2. User creates one proxy(newProxy) and send to the server.
  3. Client receives the success response and CellList begins to request newest data from server.
  4. CellList filled with newest data, and the row in step 1 is still selected.

But i want to select the the newest row in step 4, i use

selectionModel.setSelected(newProxy);

but seem it does not work and still select the row in step1.

I tried deselect the row before step 2:

selectionModel.setSelected(oldProxy, false);

but at the end it still select the row in step1, it's weird. Any ideas about this?

4

2 に答える 2

0

キー プロバイダー (インターフェイスProvidesKey) をSingleSelectionModelコンストラクターに渡していることを確認してください。キー プロバイダーを使用しない場合、おそらくequals()プロキシで使用して一致を見つけようとしますが、サーバーから新しいインスタンスを要求したため、古いインスタンスは新しいインスタンスのいずれとも一致しません。

こちらの GWT ドキュメントで例を見つけることができます。

関連項目: SelectionModel または ListDataProvider を使用して CellList 内の要素を選択する

于 2013-04-29T16:53:44.137 に答える