2013-01-09 4 views
3

각 행의 CheckBox가있는 GWT 프로젝트에 CellTable이 있습니다. 어떻게 든 cellTable의 모든 행을 반복해야하고 각 행의 CheckBox가 선택되었는지 확인하려면 이 필요합니다.GWT CellTable with CheckBoxes 모든 선택된 상자 가져 오기

나는 어떻게하는지 알지 못한다.

private Column<Article, Boolean> showPinColumn = new Column<Article, Boolean>(new CheckboxCell()) { 
    public Boolean getValue(Article object) { 
     return false; 
    } 
}; 
+0

[GWT : cellTable의 체크 박스 값을 얻는 방법] 가능한 복제본 (http://stackoverflow.com/questions/12476521/gwthow-to-get-the-value-of-a-checkbox- of-a-celltable) –

답변

4

1 단계 - showPinColumn 코드를 수정하고 FieldUpdater를 사용하여 실제로 개체를 업데이트해야합니다. 당신은 당신이 celltable로 설정하고 문서의 부울 속성에 대한 확인 "목록"의 각 항목을 반복해야

final CheckboxCell cbCell = new CheckboxCell(); 
Column<Article, Boolean> cbColumn = new Column<Article, Boolean>(cbCell) { 
    @Override 
    public Boolean getValue(Article object) { 
     System.out.println("method getValue() - " + object.id + " - " + object.checked); 
     return object.checked; 
    } 
}; 

cbColumn.setFieldUpdater(new FieldUpdater<Fieldupdater.Article, Boolean>() { 
    @Override 
    public void update(int index, Article object, Boolean value) { 
     System.out.println("method update() - " + object.id + " - " + value); 
    } 
}); 

단계 2.

+0

고맙습니다. 작동합니다;) – user1882812