DataTables warning: table id=table_name - Invalid JSON response.

DataTables warning: table id=table_name - Invalid JSON response.

karasukarasu Posts: 27Questions: 2Answers: 0

Hi all,

since one week I get the following error message in one page what I never changed:
DataTables warning: table id=table_name - Invalid JSON response.

I checked all files and all forum but I don´t find why this error appears.

Today I look at the page resources and I saw that the following error appears in the file table.bookings_dm.php

<br />
<b>Fatal error</b>: Uncaught Error: Call to undefined function number() in /php/Editor/Field.php:593
Stack trace:

0 /php/Editor/Editor.php(803): DataTables\Editor\Field->optionsExec(Object(DataTables\Database))

1 /php/Editor/Editor.php(555): DataTables\Editor->_get(NULL, Array)

2 /table.bookings_dm.php(120): DataTables\Editor->process(Array)

3 {main}

thrown in <b>/php/Editor/Field.php</b> on line <b>593</b><br />

Can someone help me please? Show me a way because I really have not changed anything in the files.

Best

Replies

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin

    Could you show me the code in your table.bookings_dm.php file please? It looks like that was created with Generator - is that the case?

    Thanks,
    Allan

  • karasukarasu Posts: 27Questions: 2Answers: 0

    Please Download the corresponding files from this link:
    ertan-atay.com/folder.zip

    After your download can you please give me a notice? Then I can delete the download file.
    Thanks

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin

    Thanks - I've got the file now.

    The line I have in Field.php, line 593 is:

    $val = $this->_getAssignedValue( $this->_getValue );
    

    Does that match in the Editor libraries you are using? What version are you using?

    The one thing that looks odd to me in the code is the options() list for the bookings.internal_id field.

    Its being called twice, with a different number of parameters (looks like column names)? The documentation here shows how the options() method can be used.

    Regards,
    Allan

  • karasukarasu Posts: 27Questions: 2Answers: 0

    Hi Allan,

    In the /php/Editor/Editor.php file is the following version

    /**
    * DataTables PHP libraries.
    *
    * PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
    *
    * @author SpryMedia
    * @version 1.6.0-dev
    * @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
    * @license http://editor.datatables.net/license DataTables Editor
    * @link http://editor.datatables.net
    */

    and in the /php/Editor/File.php the line 593 is not matching.
    For me, the following is in it:

    for ( $i=0, $ien=count($rows) ; $i<$ien ; $i++ ) {
    $out[] = array(
    "label" => $formatter( $rows[$i] ),
    "value" => $rows[$i][$value]
    );
    }

    I deleted the following line table.bookings_dm.php and it works again ;)
    The funny thing is that I did not change anything in this file and it did not work anymore.
    It works again after deleting the line.

    But I am very happy and thank you very much for your support.

    Best regards

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin

    1.6.0 is fairly old now - it might be worth updating to 1.7.0 which has a number of improvements. However, good to hear you've got it working now.

    Allan

  • karasukarasu Posts: 27Questions: 2Answers: 0

    If I have not made any changes to the files can I just upload the following files:
    https://editor.datatables.net/download/download?type=php

    Do I have to update something else?

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin

    Yes - you should be able to just replace them like for like.

    Allan

This discussion has been closed.