Hi,
i'm trying to create a table with a variable number of columns
i have an object with 2 properties:
- the name
- a list of values
i want the table to display the name as column 1 and for column 2 3 4 ... to display the data from the property represented as a list.
now searching all over the internet i found 2 possible solutions @Path annotation or building a custom value provider
but:
1) i could not figure out how to make a path annotation like
@Path("resultList") and add an index to it (i would not prefer this idea too much as it assumes i'll hard code a lot and defies the purpose of a true dynamic number of columns)
2) i could not figure out how to write a custom value provider that will take an index as an argument and return the data fro that index
Code:
//this works
ColumnConfig<Compare, String> nameColumn = new ColumnConfig<Compare, String>(resultsProps.name(), 80, "Name");
someColumnConfigList.add(nameColumn);
//this does not
for (int i, i < size of resultList, i++) {
ColumnConfig<Compare, String> someColumn = new ColumnConfig<Compare, String>(new CUstomValueProvide(1), 80, "C"+i.toString());
someColumnConfigList.add(someColumn);
}
Code:
public class Compare implements Serializable {
private static int ID = 0;
private String name;
private List<String> resultList;
private int id;
public Compare() {
this.id = ID++;
}
public Compare(String name, List<String> resultList) {
this();
this.setName(name);
this.setResultList(resultList);
}
any ideas ? how to build a custom value provider able to access different indexes of the "resultList"