datatables serverside edit button not working on smart phone only?

datatables serverside edit button not working on smart phone only?

chessGuru64chessGuru64 Posts: 79Questions: 18Answers: 1

No one on stackoverflow seemed to be able to solve this. Make sure an answer has not already been posted. https://stackoverflow.com/questions/54192569/datatables-jquery-library-server-side-edit-button-not-working-on-smartphone

Link to Datatables Library, serverside: https://databasetable-net.000webhostapp.com/

My edit button does not populate the data row or ID on a smart phone only. But it WILL work responsively on a computer at ANY screen size. What would cause this?!?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @chessGuru64 ,

    I don't see why you need this line:

    var rowData = $('#example').DataTable().row($(this).parents('tr')).data();
    

    You've got the data in this earlier line:

    var edit_id = $('#example').DataTable().row( id ).data();
    

    You could use that to populate the edit.

    Cheers,

    Colin

  • chessGuru64chessGuru64 Posts: 79Questions: 18Answers: 1

    Yes there probably is an easier way but that was the way I thought of using stackoverflow. The ajax could not be responding for whatever reason on the phone, I will try to add the edit_id manually too before the ajax call:

    var id = $(this).attr("id");;
    var edit_id = $('#example').DataTable().row( id ).data();
    var edit_id = edit_id[0];
    $('#editId').val(edit_id);

This discussion has been closed.