Click here to Skip to main content
15,894,343 members

How to Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database(MySql)?

jitendra BABA asked:

Open original thread
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: http://www.isocra.com/2007/07/dragging-and-dropping-table-rows-in-javascript/#demo[^]). 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.
C#
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?
Tags: Javascript, Java, HTML, Ajax, MySQL, JSP, Struts

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900