PDA

View Full Version : [CLOSED] Grid record not updated with the modified value, when session is configured



sriram139
30 Apr 2014, 8:13 AM
Description:

When Grid is configured with session, changes done by other process does not reflect on the UI on store reload.
Steps to reproduce the problem:

- Configure a grid with session true- Add pagination and make sure grid is loaded with multiple pages- After grid is rendered, observe the first record- Go to second page- Assume external process has updated the first record which we observed in page-1. We tried using just an update in our DB- Navigate back to Page-1
Record does not reflect the modified value even though it is sent properly by the serviceRecord is not modified

evant
30 Apr 2014, 8:18 AM
You'll need to post a test case. What do you mean by "external process"?

sriram139
30 Apr 2014, 10:21 AM
It's difficult to put in a test case as we need to update the value in DB and show the scenario.
I will try to put my test scenario to make it clear:

- Create a Grid with Pagination
- Bind to a store which is loaded from a rest service
- Session is enabled for the grid
- Render the grid with data at least spanning 2 pages
- Note the first record in the first page
- Go to second page
- Modify (say one of the fields) the first record in the first page in your Data source which is DB in my case with an update query
- On UI, navigate back to first page as we were in second page.

Since store fetches the first page from the rest service, it should reflect the change done in my DB
But in this case, it shows the same record as earlier before making the change.
If we can see the response of store load on navigating to first page, the record is fetched with changed value, however it does not show the change on UI even when you refresh the Grid using 'refresh' button on paging toolbar.

We have put the same concern in one of the forum posts:
http://www.sencha.com/forum/showthread.php?284468-Session-updating-records

Regards,
Sriram

evant
30 Apr 2014, 10:43 PM
This isn't a bug, but rather a "feature" of the session. One of the main purposes of the session to ensure we have consistent access to records and as an extension of that, their associations.

There are several issues with the scenario your pointed out:
1) What if there are pending local to changes to the record, how do we resolve the conflict?
2) It's possible that various keys in the object could change which would subsequently affect associations.

Not to say we can't look at this, but it's not a bug in the sense that it's behaving as intended (for now).

sriram139
1 May 2014, 7:51 AM
For the points given:
1) What if there are pending local to changes to the record, how do we resolve the conflict?

- If there are pending local changes to the record, we expect it to not to refresh that record with the new values from the service. Other records which are not dirty are expected to be refreshed with latest data. If not, we have to close the session and open everytime we want to see the latest data which is weird.

2) It's possible that various keys in the object could change which would subsequently affect associations.

- Keys are not expected to be changed. If so, then there can be no foreign key relationship to establish between models. In EXTJS, I believe there can be only one id property for any model to be used with associations. If the key is changed, then it will be a new record for the store, but not an update to existing.