get name of checkbox in gwt java -
when create table array, fill ithe first column values present in array, second column being ckeckboxes values of index of array. need retrieve name of selected checkbox. below code, me please?
thanks help!
public class adddoodlepart3 extends composite { mainview main = new mainview(); flextable table= new flextable(); verticalpanel ab = new verticalpanel(); horizontalpanel hor = new horizontalpanel(); inlinelabel lb = new inlinelabel("tette"); checkbox ck ; textbox orario = new textbox(); button btn = new button("inserisci"); int culo; public adddoodlepart3(string det, arraylist<string> listdate){ initwidget(this.ab); this.ab.add(lb); system.out.println(det+listdate.size()); table.settext(0, 0, " "); table.settext(0, 1, "opzione"); table.settext(0, 2, " "); system.out.println("1"); for(int i=0;i<listdate.size();i++){ system.out.println(i); this.ck = new checkbox(""+i); table.setwidget(i, 0, ck); table.settext(i, 1, listdate.get(i)); ck.addclickhandler(new clickhandler() { @override public void onclick(clickevent event) { boolean checked = ((checkbox) event.getsource()).getvalue(); window.alert("it " + (checked ? "" : "not ") + "checked "+ culo); } }); } this.ab.add(table); this.hor.add(orario); this.hor.add(btn); this.ab.add(hor); btn.addclickhandler(new clickhandler() { @override public void onclick(clickevent event) { // system.out.println(culo); } }); }
}
you should use datagrid widget these purposes. see gwt showcase example. click on source code link see how implement datagrid.
you can set selectionmodel on datagrid - in case need multiselectionmodel. then, getting list of selected items easy as:
selectionmodel.getselectedset();
Comments
Post a Comment