View Full Version : Updating data and views

4 Jan 2011, 10:55 AM

I am working on an iPhone offline App (all is data cached in the local SQLite and all files are manifested).
All of the panels and other Ext elements are created, displayed and handled perfectly.
Sencha had really been a pleasure.

I'm having trouble with handling events and updating data structures.

Q1: how do i update a panel with new information?
I have a panel with various panels in it (buttons, textFields, html etc...), i want some new data to be saved to the db (have that part covered) and that this entire panel will be reloaded again with the new data.

pseudo code:

function getPanel(data) {
// prepare this panel according to the data
id: 'updateMePanel';
items: [
someButtonHandler: function() {
// save stuff to the local DB, read/set new data to newData
mainPanel.update('updateMePanel', getPanel(newData));
// or

var mainPanel = new Ext.Panel({

Q2: can i please see a simple code example where i update/reload a store's (specifically used in a NestedList) data?
this will also be read from the DB and parsed with a 'memory' proxy.


5 Jan 2011, 10:35 AM
Q1 I think your looking for doComponetLayout(). Also you might want to take a look at Ext.Dataview. This is bound to a store and should update when that store fires a datachanged event.

Q2 I think your looking for a TreeStore with a WebStorage proxy and the TreeStore's sync() method
*note I haven't done this yet

see my comment here (http://www.sencha.com/forum/showthread.php?120147-NestedList-and-TreeStore-with-ajax-proxy) for an example of using a treestore with a nested list. I think if you modify it to use a web storage proxy you can use the sync() method to update/reload a store data. Also, I *believe* that when you modify a model that is a member of the store, it should fire the data changed event and update the list automatically.

6 Feb 2011, 12:49 PM
@gcallaghan, your proposal for Q2 did not work for me. Have you come across any working solution since that post?

22 Mar 2011, 12:10 AM
@Bunchofstring I've moved everything to using ordinary Lists, everything works great...

23 Mar 2011, 8:19 PM
@wizman, I just wish there was a way to update nested lists bound to a store. Even better would be a way to bind the list to a different store. I've put days of time into this particular issue and I'm giving up for now. Hopefully someone more clever than I will figure out a way to do that.