Click here to Skip to main content
13,768,191 members
Rate this:
Please Sign up or sign in to vote.
Hi all: I met a problem like this. Here is the scenario: if I have a database table A, which contains several columns, for example. Once the sever pass the database to web client, it's rendered into a HTML table. Now, here is some requirements for the client side. The user will be able to add/delete several rows from the HTML table, in addition, they will also be able the change the row order. If we could finish the client side with the help from some jquery plugin (for example:[^]). Now, my question is, how could I pass this information back to server? Because there are new rows and deleted rows, the original table row order (like the plugin tableDnD.serialize function is not sufficient) is not enough. How to do this?Please let me know if anyone have idea about that.I got stuck in it since 5 days.Thanking you in advance

on drop this javascript function is calling.
this.onDrop = function(table, droppedRow) {
       // alert("ondrop1");
       var rows = this.table.tBodies[0].rows;
       var debugStr = "rows now: ";
       for (var i=0; i<rows.length; i++) {
           debugStr += rows[i].id+" ";
       //  alert(debugStr);
   //  document.getElementById('debug').innerHTML = 'dropped<br>'+debugStr;

now i have to send new position of row to server side.How to do this?
Posted 21-Mar-12 0:57am
Updated 26-Mar-12 2:55am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

you need a mouse event for "mouseup". in that moment you can figure the new row number and work with that one.[^]
jitendra BABA 21-Mar-12 23:07pm
Thank you for your answer.I am using this website ( ) code for Dragging and droppping .It is working fine but the problem is that how to save this new row position in database.
TorstenH. 22-Mar-12 2:27am it is NOT about JSP, the table or the event. You just don't know how to handle a database.

Do you have a SQL database?

Here is a simple tutorial on how to store something in a database.
Insert data in mysql database through jsp using prepared statement @orseindia
jitendra BABA 22-Mar-12 2:41am
I know how to insert any values or records in database but problem is that how to send new position on row(html table after dragging) to java Class(code).for this they( ) are using a function

/** This function is called when you drop a row, so redefine it in your code
to do whatever you want, for example use Ajax to update the server */
this.onDrop = function(table, droppedRow) {

// Do nothing for now

in javascript code. So I have to sent this droppedRow id to javaCode.please share with me your views.
TorstenH. 26-Mar-12 6:18am
Don't push your question.

You should probably address the server and tell him about your client's decision to change the row numbering. I would suggest a POST Request
jitendra BABA 27-Mar-12 1:23am
@TorstenH. Thank you for given me a such good link.It is really a nice tutorial for AJAX.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.181116.1 | Last Updated 26 Mar 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100