Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT CellTable with CheckBoxes get all selected Boxes

i have a CellTable in my GWT Projekt with a CheckBox in each row. Somehow i need to iterate over all rows in the cellTable and need to check if the CheckBox of each row is selected or not.

I dont know how to do that and i cant find anything that shows how.

private Column<Article, Boolean> showPinColumn = new Column<Article, Boolean>(new CheckboxCell()) {
    public Boolean getValue(Article object) {
        return false;
    }
};
like image 936
user1882812 Avatar asked Jul 12 '26 10:07

user1882812


1 Answers

Step 1 - You should fix your showPinColumn code and use FieldUpdater to actually update the object.

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);
    }
});

Step 2- You should only iterate over each of the items in the "list" that you set into the celltable and check for the boolean property in Article.

like image 163
appbootup Avatar answered Jul 15 '26 08:07

appbootup



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!