1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
public HtmlDataTable getDataTable(List myList, int nbColum) {
ListDataModel rowModel = new ListDataModel(myList);
System.out.println("création de la datatable!!!!!");
//UIForm form=new UIForm();
//form.setId("form");
//form.setRendered(true);
HtmlDataTable table = new HtmlDataTable();
//table.setId("tableId");
table.setVar("myItem");
table.setValue(rowModel);
int tmpi = 0;
System.out.println("je suis avan le foooooooooooor");
for (int i = 0; i < nbColum; i++) {
System.out.println("Set header"+i);
// Set header
UIOutput header = new UIOutput();
header.setId("header" +i);
header.setValue("HEADER " + i);
// Set output
UIOutput output = new UIOutput();
output.setId("output"+i);
ValueBinding myItem = FacesContext.getCurrentInstance()
.getApplication()
.createValueBinding("#{myItem[" + i + "]}");
output.setValueBinding("value", myItem);
///output.set
// Set output
UIColumn c = new UIColumn();
c.setId("column" + i);
c.setHeader(header);
c.getChildren().add(output);
table.getChildren().add(c);
}
// Set footer
UIOutput footer = new UIOutput();
footer.setId("footer");
HtmlDatascroller myScroll = new HtmlDatascroller();
myScroll.setId("scroller");
myScroll.setRendered(true);
myScroll.setMaxPages(2);
footer.getChildren().add(myScroll);
table.setFooter(footer);
return(table);
} |
Partager