Help needed - Adding and Deleting rows from datatables

Help needed - Adding and Deleting rows from datatables

pbagch200pbagch200 Posts: 8Questions: 0Answers: 0
edited May 2011 in General
I am new to not only datatables but also to web development. I am sure the problem I am facing is very simple but after two days of googling and searching through the forum I decided to finally ask for help. I am using datatables with the jeditable plugin using MySQL DB and PHP server side processing. I need to update, add and delete records. I have been able to implement the update portion (thanks to the forum!).

In the delete portion when I click 'delete' the record is deleted from the DB but the page is not refreshed to show the reduced set of data. After going through the forum I guess it is because I am getting sEcho=0 but I am not able to get around it.

In the add section the effect is not even taking place in the DB.

My table has an id column which is autoincremented.

Following are the portions of the code:
[code]

$(document).ready(function(){
$('#the_table').dataTable({"bFilter": false ,
"bInfo": false,
"bPaginate": false,
"bProcessing": true,
"bServerSide": true,
'sAjaxSource':'datatables.php',
"aoColumns":[
{
"bVisible" : false //id
},
{}, //Column2
{}, //Column3
{}, //Column4
{}, //Column5
{} //Column6
]
}).makeEditable({
sUpdateURL: "UpdateData.php",
sAddURL: "AddData.php",
sDeleteURL: "DeleteData.php"
});
});

[/code]

AddForm:
[code]
Add
Delete


column2


column3


column4


column5


column6



[/code]

Replies

  • pbagch200pbagch200 Posts: 8Questions: 0Answers: 0
    edited May 2011
    DeleteData.php
    [code]
  • pbagch200pbagch200 Posts: 8Questions: 0Answers: 0
    Can someone please help me with this?
  • dmolavidmolavi Posts: 65Questions: 0Answers: 0
    i can't get the add function to work w/ the makeeditable feature, either. any help would be appreciated. here's my code that handles the addition of the record:

    [code]
  • ldopsonldopson Posts: 4Questions: 0Answers: 0
    Did you ever get this working?

    I do think that for a delete on the sever using makeEditable you need to return an "ok" string or the ID of the row.
  • ldopsonldopson Posts: 4Questions: 0Answers: 0
    Confirmed...

    It should be "ok" that it returns, verify using Firebug or Developer Tools and make sure that your server code produces the right Mediatype.


    Leo
  • pbagch200pbagch200 Posts: 8Questions: 0Answers: 0
    Thanks Idopson, it worked :).

    Gosh always felt it was something simple.
  • pbagch200pbagch200 Posts: 8Questions: 0Answers: 0
    Now, I see a different problem altogether. When there are more than one row say 5 and I hit the delete button it deletes the row and refreshes the page. I go on doing this until there is just one row left - now when I hit the delete button it does delete it from the DB but its still there on the page and the top of the page says 'Processing...'. If I click on the row again then the delete button is again activated and I can hit that too without seeing any errors though the row has been deleted already when I first deleted it.
  • pbagch200pbagch200 Posts: 8Questions: 0Answers: 0
    Got it working.
  • sylviarssylviars Posts: 2Questions: 0Answers: 0
    Hi, i am using datatables. i have used multiple rows select and now i want to perform delete operation on multiple rows. For eg: i have selected 2,3,4 rows, so i want all the 3 rows to get deleted at the same time.
  • allanallan Posts: 35,336Questions: 1Answers: 3,658 Site admin
    @sylviars: Can I suggest you create a new thread for your question. Also if you could show us the code that you are currently using to do the delete that would be good (presumably a loop of fnDeleteRow).

    Allan
  • rduntonrdunton Posts: 2Questions: 0Answers: 0
    @pbagch200 I haven't read all the comments but as far as your first questions go, try checking out JSONData.com. It's a program that is in beta right now but should help with your problem.
This discussion has been closed.