PDA

View Full Version : MemoryProxy and loader.load error



zdarsky
16 Jul 2009, 10:35 PM
Hi,

I'd like to have two grids on a page without a need to get data from a server.
When I select one row on the first grid I'd like to refresh data on the second grid.

My current implementation is:
questionList = new ArrayList<QuestionBO>();
proxy = new MemoryProxy<List<QuestionBO>>(questionList);
BeanModelReader reader = new BeanModelReader();
loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);
store = new ListStore<BeanModel>(loader);
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig(QuestionBO.Fields.TEXT.getFieldName(), i18nConstants.questionText(), 200));
columns.add(new ColumnConfig(QuestionBO.Fields.VALUE.getFieldName(), valueDesc, 70));
ColumnModel cm = new ColumnModel(columns);
grid = new Grid<BeanModel>(store, cm);
grid.setAutoExpandColumn(QuestionBO.Fields.TEXT.getFieldName());
loader.load();

When I need to update data I call:
questionList.clear();
questionList.addAll(newQuestionList);
proxy.setData(questionList);
loader.load();


Then I receive an error that it isn't possible to assing QuestionBO to ModelData. The QusetionBO is our business object and I created Bean Model:
@BeanModelMarker.BEAN(QuestionBO.class)
public interface QuestionBeanModel extends BeanModelMarker {}

What is wrong? Why can't I reload data from MemoryProxy?

best regards,
Martin Zdarsky