dataTable doesn't retrieve a field when....

dataTable doesn't retrieve a field when....

arielfmdparielfmdp Posts: 6Questions: 2Answers: 1

I'm working on localhost.

The issue is that dataTable doesn't retrieve a field when the data stored in it is large, let's say about 4kb, and it's not any complex data, it's only text with dates, CR LR characters, tabs, and numbers, no more than that.

I'm doing server-side procesing with POST method now, but I also tried GET.
I request 10 fields to the database with the server-processing.php script.
Then, I show only 8 fields on a table with a nineth column added only for buttons, and for the reminding 2 fields, I use the show extra/detailed information api explained here http://datatables.net/examples/api/row_details.html.
The result is that the field named "Ficha" (or index 8 in server-processing script), sometimes come null.
What I could realize is that it happens when the data stored in "Ficha" is large, but sometimes also occurs with less data. So I cannot get the point for this behavior.

My debug data is here:
http://debug.datatables.net/oxalaj

Hope you can help.
Thanks a lot

Best regards,
Ariel

Replies

  • arielfmdparielfmdp Posts: 6Questions: 2Answers: 1

    well, I think I've found the solution.
    The key is to modify the charset option of the PDO_MYSQL connection function in ssp.class.php.
    I didn't find a more simple way to do it for all the database in just one line, so, I edited that class.

    Only add PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
    in the array options of the connection in sql_connect funcion. It should be this way:

    static function sql_connect ( $sql_details )
    {
        try {
            $db = @new PDO(
                "mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
                $sql_details['user'],
                $sql_details['pass'],
                array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                       PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' )
            );
        }
    

    With that, Now I can not also show, I can also search with special chars like the latins áéíóúñ etc

    Well, it almost drives me crazy, but I didn't give up and I found one solution reading the php manual.

    I hope this helps to others too.

This discussion has been closed.