Do you need editable to be able to delete a row?

Do you need editable to be able to delete a row?

Tigger996Tigger996 Posts: 2Questions: 0Answers: 0
edited August 2012 in General
I would call myself a total rookie when it comes to jquery/ajax. I'm using php to populate a table. What I would like to do is be able to have
my user select a row and be able to click delete.

I would prefer not to have to pay for editable, I just want to delete records.

Can someone please lead me in the right direction. I'm so frustrated.

All I have right now is this:

[code]
$(document).ready(function() {
$('#results_table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sScrollY": 200,
"sScrollX": "100%",
"sScrollXInner": "110%",
"sAjaxSource": "getdata.php"
} );
} );
[/code]
HTML:

[code]


Date
description
peelThickness
largeSheetCount
largeSheetDivertedCount



Loading data from server




Date
description
peelThickness
largeSheetCount
largeSheetDivertedCount



[/code]

Replies

  • arjun_adhikariarjun_adhikari Posts: 32Questions: 0Answers: 0
    hi Tigger996,
    why dont you try the jQuery DataTables Editable by Jovan Popavic then, its give under third party plugin in the following link
    http://www.datatables.net/extras/
    i myself have used the plugin for adding and deleting rows, hope this solves what you were looking for.

    Arjun.
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    To delete the row, you want to make an Ajax call to the server that will run SQL such as 'DELETE FROM 'myTable' WHERE id = {post_id}'. Then simply call fnDraw on the table and that's it. Editor and any other plug-in for DataTables that offers that functionality is basically doing that.

    Allan
  • Tigger996Tigger996 Posts: 2Questions: 0Answers: 0
    arjun_adhikari, I've downloaded the latest version (which says its deprecated).
    It looks like I have to add an id to the . I've looked at hundreds of different ways to do this. Can you please direct me on this. Like I say, my skills in this are low :)

    TIA
  • arjun_adhikariarjun_adhikari Posts: 32Questions: 0Answers: 0
    edited August 2012
    hi tigger996,
    dont use the editable plugin rather do it the way allen has posted above
    here is what i have done
    1.i had retrieved my id value in a column and have hidden it using,
    [quote] "aoColumnDefs":[{"aTargets":[0],"bSearchable":false,"bVisible":false}],
    "0" being the 1st column position keep you id in it.[/quote]

    2. use table tools plugin to enable selecting a row or any other method you want

    3. i got the id of the selected row using, since there is no id given by us, datatables will automatically pick the first column value as its id.
    [code]
    function fnGetSelected( oTableLocal )
    {
    var aReturn = new Array();
    var aTrs = oTableLocal.fnGetNodes();
    for ( var i=0 ; i
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Or you could make life easy on yourself and use Editor: http://editor.datatables.net :-). Its designed to specifically to save time when setting up CRUD tables!

    Allan
This discussion has been closed.