Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to delete the row on click of a checkbox instantly ?

 
sanat meher
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can anybody tell me how to make a row disappear on click of checkbox and clicking or submiting the form.

I have a form which shows the data from a table in the database in tabular fashion(row and columnwise).And corresponding to one column i have associated a checkbox fro each row of the datable.So when i select one or more than one checkbox,and click on the submit button,it will perform some action and display those selected items in the same form or different form.but i click the submit button,then those selected rows are still there and when i refresh the page then only those are getting disappeared.but i want those selected columns to be disappeared instantly on clicking the submit button without refeshing the page repeatedly.
Can anybody tell me how to do the same.

My code is like this:





Regards,
Sanat
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a good idea to put all this logic in the view/JSP. You should probably refactor it to a servlet or preferably the model. For what you are trying to do, you can have some javascript code that will execute on the click event of the checkbox, and call your backend method to do the delete.
 
Soumik Basu
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest that you use AJAX.Then you need not have to submit also and get the page refreshed.
All you need to do is learn using AJAX from some tutorials and put your to be shown table in a div tag and on click of the button(which was your submit button previously)call the method written in AJAX and through AJAX call another jsp or servlet where you write the query for deleting the row.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic