PDA

View Full Version : live grids



micr75
22 Mar 2011, 2:13 AM
Hi,
I am building an application that receives real time updates from a remote server using an AJAX framework.

My aim is to have a Grid update in real time as events arrive.
As a second phase I'd like to colour the cells that have updated for a certain time.

I have something working but it's slow and it feels like a hack.
I've built my own DataReader and Proxy which are injected into a BasePagingLoader which in turn populates a ListStore which is used to populate a Grid using a a LiveGridView.
My proxy generates ModelData objects and updates them when updates arrive.

The proxy calls "notify(new ChangeEvent(Update, this));" after updating model objects upon receiving updates.
"this" is an instance of a BaseModel which is registered with my Store.


The only way I got my cells to refresh was the following:

StoreListener<ModelData> storeListener = new StoreListener<ModelData>() {
public void storeUpdate(StoreEvent<ModelData> se) {
liveView.refresh(false);
}
};

store.addStoreListener(storeListener);

I am thinking that there has to be a better way to do this.
My store should automatically propagate events to the GridView which should refresh itself accordingly.

I have been struggling with the API for a bit but I haven't found a satisfactory solution.

Any help would be appreciated.

thanks,
Michele