PDA

View Full Version : [Solved] Question about datastore, refreshing the data and the impact on the UI



Elijah
15 Jun 2010, 4:32 AM
Scenario:
Using a GridPanel and a DataStore.
The data store automatically gets data from server every 60 seconds.


Question.
How does the grid panel get updated if the data is updated in the datastore?
How does the grid panel know to refresh when the datastore data is different?
How does the grid panel know that the data is different and to refresh?
(i.e.:
old data had 4 rows, new data is still the same 4 rows
or
old data had 4 rows, new data is 4 rows but 1 row is different
or
old data had 4 rows, new data is 5 rows
)
How can you make it seemless where if the user is navigating the grid panel, lets say scrolled down 3/4 of the list and new data is in the data store, how do you prevent the scroll position from being lost?

I would not want the user deal with interuptions to the UI when they are doing things.

? Would it be best to automate refreshing the data in the data store
or
Would it be best to have the user manually reload the data by clicking a reload button?

The second part seems like it would offer the path of least resistance.

Input greatly appreciated on this.

Animal
15 Jun 2010, 4:48 AM
"Events dear boy, events"*

Store backed widgets update themselves when the Store changes.

IMHO, GridView's scrolling back to the top on refresh is just a bug.

*http://en.wikiquote.org/wiki/Harold_Macmillan

Elijah
15 Jun 2010, 5:10 AM
Animal - In your opinion should I just use a button for the users to manually refresh the content?

Animal
15 Jun 2010, 5:29 AM
It's up to you how you design your app. Design it to do what needs to be done.

What needs to be done?

Elijah
15 Jun 2010, 5:55 AM
Displaying content in Grid Panels. These grid panels are loaded into a tab panel.
Total of 4 Grid panels.
Total of 4 tabs.

Makes no sense to me to have it automaticaly updating the data store since a grid may not be viewed at the time the updates are occuring. So I think it be best to have a manual request to fetch the data if any new data is even there.

But how does it know the content has actually changed? Like I said above if 4 records where there before and 4 are there now but 1 row has changed, how do you know one row has changed so that you can notify the user new content is present?

Animal
15 Jun 2010, 5:57 AM
Reload the grid on tab activation?

Elijah
15 Jun 2010, 6:00 AM
I had put a status bar with a reload button onto the panel that houses the Grid Panel. The panel is put into the tab panel. So the idea is when the user clicks the reload it will call to have the datastore reload.

Animal
15 Jun 2010, 6:31 AM
OK, a manual reload then if that's OK for you.