0
ComboxCell이있는 인라인 편집 기능이있는 그리드가 있습니다 (예 : 1,2,3,4,5 값 포함). 사용자가 한 행에서 2를 선택하면 선택한 값이 2 인 다른 행이 이전 행의 이전 값으로 변경됩니다.다른 행에있는 동일한 ComboxCell을 기반으로 한 행의 ComboBoxCell 선택 변경
ComboxCell이있는 인라인 편집 기능이있는 그리드가 있습니다 (예 : 1,2,3,4,5 값 포함). 사용자가 한 행에서 2를 선택하면 선택한 값이 2 인 다른 행이 이전 행의 이전 값으로 변경됩니다.다른 행에있는 동일한 ComboxCell을 기반으로 한 행의 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);
}