Transfer data from one table to another

Transfer data from one table to another

ian.fordian.ford Posts: 4Questions: 0Answers: 0
edited April 2010 in General
I have to say this app is really nice and has helped out a lot but the one thing I am try to do that I have not been able to do as of yet and have not seen any examples or questions in the forums is to select data from one table and move it to another.

Basically like the jquery multi select where table1 has a list of data and upon double clicking on the data it is moved to table2. (i.e. http://blog.jeremymartin.name/2008/02/easy-multi-select-transfer-with-jquery.html)

I'm sure I am just missing something but any help on this would be great.

Thanks

Replies

  • poetawdpoetawd Posts: 12Questions: 1Answers: 0
    have you tried jquery´s clone() function ?
  • ian.fordian.ford Posts: 4Questions: 0Answers: 0
    No I had not till just now and it works great thank you.
  • ian.fordian.ford Posts: 4Questions: 0Answers: 0
    Ok well clone worked great minus it when I tried to put a record from the DEST table back to the SOURCE table it added two entries to the SOURCE table. While messing around with it I found that it was not removing the entry from the aoData array which was causing the duplicate.

    I changed the code to use the fnAddData and fnDeleteRow functions and the fnAddData worked it would switch data back and forth untill I started using the fnDeleteRow which then would not allow me to add any new rows and would error out on jquery.dataTables.js line 4434 with a nTrs[iRow] is null error (this was reported in another thread http://datatables.net/forums/comments.php?DiscussionID=1636&page=1#Item_2 )

    So here is the code block to move data from one table to the next with the fnAddData and fnDeleteRow functions in them if anyone sees anything that should change to get this to work let me know.

    [code]
    // Add to DEST and remove from Source
    $('#source_move').click( function() {
    var selected_entries = fnGetSelected(oTable);
    var selected_Len = selected_entries.length;
    var i = 0;

    for(i=0; i
  • thingeethingee Posts: 1Questions: 0Answers: 0
    edited April 2011
    does this solution work? i'm also trying to make two tables which can exchange content between each other and i don't understand how the code above works. how do i use it? i'm totally lost. any help will be appreciated :)
This discussion has been closed.