PDA

View Full Version : Suggestions for loading a grid



rdopico
25 Jun 2009, 5:06 AM
Hi everyone,
I am creating a grid for showing the results of a query. The main problem is that the number of columns of the grid may vary.

I was encapsulating the query results in a bean of this form:



public class VariableGridRow {

private String fixedColumn1;
private String fixedColumn2;

private List<String> variableColumns;


}

Is there any of using a BeanModelReader to map this bean to ModelData instances? If not, which approach would you recommend to me?

Thanks in advance ;)

rdopico
25 Jun 2009, 11:49 PM
Hi again,
Yesterday I needed to solve the problem quickly, so I used a "dirty" solution:

I am converting the VariableGridRow objects to ModelData objects, and then loading the store using the Store.add(List<ModelData>) method.

By the moment I am going to leave it this way. I've been thinking about converting the query results to JSON and using a JsonReader, but I don't know if it's worth the effort, or if it's a better way to do it.

If any of you found yourself trying to load data in a table with a variable number of columns, please, let me know how did you managed to do it.

Thanks in advance :)