PDA

View Full Version : How to reload dataView using MemoryProxy?



fangzhouxing
28 May 2009, 8:45 PM
My code to create dataview:


MemoryProxy proxy = new MemoryProxy(menuNavigator.getEntries());
ListLoader loader = new BaseListLoader(proxy);

ListStore<ModelData> store = new ListStore<ModelData>(loader);
loader.load();

StringBuffer sb = new StringBuffer();
sb.append("<div class='menu-navigator-box'>");
sb.append("<div class='thumbd'><img src='{path}' width=128 height=128></div>");
sb.append("<div>{name}</div>");
sb.append("</div>");

dataView = new DataView();
dataView.setItemSelector(".menu-navigator-box");
dataView.setOverStyle("menu-navigator-over");
dataView.setSelectStyle("none");
dataView.setBorders(false);
dataView.setStore(store);
dataView.setTemplate(sb.toString());



I want to change the content of dataView, the following code don't work:


MemoryProxy proxy = new MemoryProxy(menuNavigator.loadFilterEntries(menuNavigator,category.getName()));
loader = new BaseListLoader(proxy);
store = new ListStore<ModelData>(loader);
loader.load();



Any advice? Thanks in advance!

sven
29 May 2009, 12:45 AM
You need to reset the store on the dataview

fangzhouxing
29 May 2009, 6:09 AM
but when I reset store of dataview by call setStore method, it throws an exception。

sven
29 May 2009, 6:16 AM
Yes you are right. Dataview is not designed for that. I would suggest to use listview. You have the same features there but it works directly on a store.