Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

JSP delete row and save

I am working in Spring MVC 2, Jsp, Dojo, Javascript.

Actually I am populating Jsp page table-grid with list of objects coming in form command object. Let say 3 records displayed in grid. I am deleting third record with JavaScript getElementById.. delete-row/removeChild functions. That record is deleted from presentation i.e. grid. Now when I save this. It takes 3 records to server side instead of 2. It should take 2 records because the third record was deleted. I am using Dojo to dragNdrop grid rows.

Upvotes: 0

Views: 812

Answers (3)

Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

Could not resolve issue but another logic fulfills my need. Spring form tags were used to bind this for with objectclass. Converting deleted item row's id to negative and hiding this row at client side does the trick. When form submits this negative id converted to positive value and deleted from DB.

Upvotes: 0

Mike Partridge
Mike Partridge

Reputation: 5281

If you're using a grid component that maintains a datastore - e.g. the DojoX DataGrid, you might be removing the markup for the row, but not telling the datastore to purge the row data. When the save occurs, the datastore sends all three rows.

If you are using the DataGrid, you should delete the row from the DataStore, which will be reflected automatically in the UI.

Upvotes: 1

Alban
Alban

Reputation: 1943

When I have this kind of issue, I always check the cache related headers in my response.

Could it be that the http request supposed to fetch saved data from the server in order to refresh the view doesn't hit the server, but instead hit the browser cache?

Upvotes: 0

Related Questions