serverside Individual column filtering ( text input )

serverside Individual column filtering ( text input )

kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
edited March 2014 in DataTables 1.10
the filtering on serverside is not working

http://live.datatables.net/nuxufeb/7/edit

Replies

  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    new version

    http://live.datatables.net/nimawun/3/edit
  • lyndonwillyndonwil Posts: 40Questions: 5Answers: 0
    Have a look at http://www.datatables.net/forums/discussion/20096/individual-column-filter-in-1-10#Item_1
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    merci beaucoup

    i have changed code of ' ssp.class.php ' and i can filtering all Individual column
    if ( count( $columnSearch ) ) {
    $where = $where === '' ?
    implode(' AND ', $columnSearch) :
    $where .' AND '. implode(' AND ', $columnSearch);
    }
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    when data contains spécial caracters ' èçàù...' the datatable return ' null '
    i changed ssp.class.php with utf8_encode( to return the spécial caracters in the datatable

    // Is there a formatter?
    // 28/03/2014 utf8_encode () for spécial character éàèù...
    if ( isset( $column['formatter'] ) ) {
    $row[ $column['dt'] ] = utf8_encode($column['formatter']( $data[$i][ $column['db'] ], $data[$i] ));
    }
    else {
    $row[ $column['dt'] ] = utf8_encode( $data[$i][ $columns[$j]['db'] ]);
    }
    }
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0
    il have datatable with spécial french caracter example ' pointe à pitre , château ,... and it's not possible to filter in global or individual
  • NelsonTigerNelsonTiger Posts: 3Questions: 0Answers: 0

    kqueekquee, you can add support for languages other than those that use latin characters by adding this line:

    //Set the character encoding to UTF-8
    SSP::sql_exec( $db, "SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
    

    Right before:

    $data = SSP::sql_exec( $db, $bindings, $query);
    

    In the simple() function of ssp.class.php. Then in the sql_exec() function replace the return line with this:

    return $stmt->rowCount() > 0 ? $stmt->fetchAll() : false;
    
  • kqueekqueekqueekquee Posts: 40Questions: 1Answers: 0

    thanks
    it's ok with ' SSP::sql_exec( $db, "SET character_set_client = 'utf8'"); '
    filtering it's ok when i use latin character

    SSP::sql_exec( $db, "SET character_set_client = 'utf8'");
    $data = SSP::sql_exec( $db, $bindings,
    "SELECT SQL_CALC_FOUND_ROWS ".implode(", ", SSP::pluck($columns, 'db'))."
    FROM $table
    $where
    $order
    $limit"
    );

    // Execute
    try {
    $stmt->execute();
    }
    catch (PDOException $e) {
    SSP::fatal( "An SQL error occurred: ".$e->getMessage() );
    }

    // Return all
    // return $stmt->fetchAll();
    // 23.05.2014 http://datatables.net/forums/discussion/comment/61516#Comment_61516
    return $stmt->rowCount() > 0 ? $stmt->fetchAll() : false;
    }

    christian

This discussion has been closed.