why are you setting a new store??? why not just update the existing one?? when you set a new store you have to call a reconfigure of the grid bye Pat
2010/3/7 new_newbie <[email protected]> > Hi, > > I am working on a vote widget which shows the vote by barchart. I have > problem on refreshing, showing the new statistics, after the user > click the yes button or no button. > The constructor is doing it right. It is able to put up the initialize > statistics. > The problem is on redraw after the user click the vote button. > > The following is the extract of my code > > public class VoteChart extends BarChart{ > private VoteAccessAsync voteAccessProxy; > > private Object[][] data = new Object[][]{ > new Object[]{new String("Vote"), new Integer(0), new > Integer(0)} <------Initial vote stat > }; > > private int oid; > MemoryProxy proxy; > RecordDef recordDef; > ArrayReader reader; > private Store store; > VoteChart(int _oid) //Constructor is doing the right job > { > oid=_oid; > > voteAccessProxy=(VoteAccessAsync)GWT.create(VoteAccess.class); > ServiceDefTarget endpoint = (ServiceDefTarget) > voteAccessProxy ; > endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "/ > VoteAccess"); > //this.setTitle, setXField, setYField.....The X-Y axis are displayed > correctly > recordDef = new RecordDef( > new FieldDef[]{ > new StringFieldDef("Vote"), > new IntegerFieldDef("Yes"), > new IntegerFieldDef("No"), > } > ); > > proxy = new MemoryProxy(data); > reader = new ArrayReader(recordDef); > store = new Store(proxy, reader); > store.load(); > this.setStore(store); > } > > //This following part is the one needs to be fixed. The result returns > the correct info from database. The data is updated. The MemoryProxy > is re-constructed. Have tried various way including > store.commitchanges() but still doesnt re-draw the chart. Pleease > help. > > public void loadData() > { > //AsyncCallback<Vote> > AsyncCallback<Vote> callback= > new AsyncCallback<Vote>(){ > public void onSuccess(Vote result) { > data = new Object[][]{ > new Object[]{ > new > String(result.getQuestion()), > new > Integer(result.getYes()), > new > Integer(result.getNo())} > }; > System.out.println("Data is > loaded: " + > > result.getQuestion() + " " + > > result.getYes()+ " " + > > result.getNo() > ); > System.out.println("Store > load and commit changes"); > //store.load(); > //store.commitChanges(); > > proxy = new MemoryProxy(data); > reader = new ArrayReader(recordDef); > store = new Store(proxy, reader); > store.load(); > VoteChart.this.setStore(store); > VoteChart.this.refresh(); > } > }; > voteAccessProxy.getVote(oid, callback); > > } > > Thanks a lot > > -- > You received this message because you are subscribed to the Google Groups > "GWT-Ext Developer Forum" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<gwt-ext%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/gwt-ext?hl=en. > > -- You received this message because you are subscribed to the Google Groups "GWT-Ext Developer Forum" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/gwt-ext?hl=en.
