0
私はComboxCellを持っているインライン編集のグリッドを持っています、それは1,2,3,4,5の値を含んでいます。ユーザーが1行で2を選択すると、選択された値が2である他の行が前の行の以前の値に変更されるような機能が必要です。別の行の同じComboxCellに基づいて1行のComboBoxCellの選択を変更します。
私はComboxCellを持っているインライン編集のグリッドを持っています、それは1,2,3,4,5の値を含んでいます。ユーザーが1行で2を選択すると、選択された値が2である他の行が前の行の以前の値に変更されるような機能が必要です。別の行の同じComboxCellに基づいて1行のComboBoxCellの選択を変更します。
これは、ComboBoxエディタを列に追加することで実装しました。
combo.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
@Override
public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
Integer item= event.getItem();
ColumnConfig<Sample, Integer> column= columnModel.getColumn(1);
ComboBox<Integer> box= (ComboBox<Integer>)event.getSource();
String text= box.getSelectedText();
Collection<Store<Sample>.Record> records= ivGrid.getStore().getModifiedRecords();
if(records.isEmpty())
{
Sample sample= getSampleByIndex(item);
if(sample!=null)
{
Record record = listStore.getRecord(sample);
record.addChange(sampleValueProvider.index(), Integer.parseInt(text));
}
else
{
Sample sample2= listStore.get(item-1);
if(sample2!=null)
{
Record record = listStore.getRecord(sample2);
record.addChange(sampleValueProvider.index(), Integer.parseInt(text));
}
}
return;
}
for(Record r : records)
{
Sample currentSample= (Sample) r.getModel();
Change<Sample, Integer> displayOrder= r.getChange(sampleValueProvider.index());
if(displayOrder==null)
continue;
if(displayOrder.getValue()==item)
{
Record record = listStore.getRecord(currentSample);
record.addChange(sampleValueProvider.index(), Integer.parseInt(text));
}
}
ivGrid.getView().refresh(true);
}