DataTables logo DataTables

sUpdateUrl in makeEditable() function return Alert Box instead of Updating cell (PHP)
  • Having issues using the php back end. I am following your example precisely but am only getting an alert box containing the value I attempted to edit. The simple

     sUpdateURL: function(value, settings)
        {
            return(value); 
        }
    works fine (of course not actually changing the data source), but the echo $value return the right value but in an alert box without changing the cell value of course. Any idea what I'm doing wrong? here is some of my code:
    $(document).ready(function () {
            $('#example2').dataTable({
                "bPaginate": true, 
                "bProcessiong":true,
                "bServerSide":true,
                "iDisplayLength": 10,
                "bAutoWidth": false,
                "sPaginationType": "four_button",
                "sAjaxSource": "Assets/Data/PackJSON.txt",
                "aoColumns": [{ "bVisible": false }, { "bVisible": false }, null, null, null, null, null, null, null],
                "sDom": 'Rlfrtip',
            }).makeEditable({
                sUpdateURL: "Updates/PackUpdate.php",
                "aoColumns": [null, null, null, null, {
                    indicator: 'Saving...',
                    tooltip: 'Click to select town',
                    loadtext: 'loading...', 
                    type: 'select',
                    onblur: 'submit', 
                    data: "{'USPS':'USPS','UPS':'UPS','TNT':'TNT','USP2':'USP2','USP3':'USP3','USP15':'USP15','USP45':'USP45','USPS12':'USPS12'}"}, {}, {}]
    
    
                //add a click event to every row in the table
            });
        });
    }
    
    
  • I have the same issue. Also cant get table to update after an edit.
  • Someone managed to make it work?
  • I am the same, give the trick ?
  • i have the same problem.In updateurl what is value, settings parameters
  • I fixed this today - check that there are no blank lines after your closing script tag e.g.
    <?php
    ...yada yada...
    ?>
    
    
    
    ...is wrong - get rid of the training blank lines after the closing tag
  • http://code.google.com/p/jquery-datatables-editable/wiki/HTMLSource

    [...] Function should return the SAME value that is posted - any other text will be shown as an error message [...].

    e.g
    post "TEST" , return "TEST"
  • I have return the same submitted value in my PHP controller calss as bellow

    echo $_REQUEST['value'];

    But i still have the alert popup showing. There is a space appended to the return value

    Fix: trim the values in jquery.dataTables.editable.js on line number 150.

    if (sNewCellValue == sValue) {

    to

    if (sNewCellValue.trim() == sValue.trim()) {
  • samarasa,

    Thank you!!! I've been banging my head into the desk for hours trying to figure this out. I wondered if it was a space situation, but didn't think about editing the datatables js. Your fix did the trick.

    Thanks again
This discussion has been closed.
All Discussions