gradeA

gradeA

yankeesierrayankeesierra Posts: 2Questions: 0Answers: 0
edited October 2013 in DataTables 1.8
Hello, first of all, thank you very much for this tool, my question is regarding the gradeA class that I can see in all examples tr elements in my implementation is not showing up, is this only available in DataTables 1.9 ? my tr tags only show odd and even classes.

Thank you very much

Replies

  • yankeesierrayankeesierra Posts: 2Questions: 0Answers: 0
    edited October 2013
    Answering my own question, you have to set in your server-side script the variable DT_RowClass here is an example:
    [code]
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
    /*
    * Script: DataTables server-side script for PHP and MySQL
    * Copyright: 2010 - Allan Jardine
    * License: GPL v2 or BSD (3-point)
    */

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    * Easy set variables
    */

    /* Array of database columns which should be read and sent back to DataTables. Use a space where
    * you want to insert a non-database field (for example a counter or static image)
    */
    $aColumns = array( 'id', 'C2', 'C3', 'C4', 'C5' );

    /* Indexed column (used for fast and accurate table cardinality) */
    $sIndexColumn = "id";

    /* DB table to use */
    $sTable = "tabletouse";

    /* Database connection information */
    $gaSql['user'] = "user";
    $gaSql['password'] = "pass";
    $gaSql['db'] = "dt";
    $gaSql['server'] = "localhost";



    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    * If you just want to use the basic configuration for DataTables with PHP server-side, there is
    * no need to edit below this line
    */

    /*
    * MySQL connection
    */
    $gaSql['link'] = mysql_connect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
    die( 'Could not open connection to server' );

    mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
    die( 'Could not select database '. $gaSql['db'] );


    /*
    * Paging
    */
    $sLimit = "";
    if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
    {
    $sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
    mysql_real_escape_string( $_GET['iDisplayLength'] );
    }


    /*
    * Ordering
    */
    if ( isset( $_GET['iSortCol_0'] ) )
    {
    $sOrder = "ORDER BY ";
    for ( $i=0 ; $i $iFilteredTotal,
    "aaData" => array()
    );

    while ( $aRow = mysql_fetch_array( $rResult ) )
    {
    $row = array();
    $row['DT_RowId'] = 'row_'.$aRow[0];
    $row['DT_RowClass'] = 'gradeA ';
    for ( $i=0 ; $i

    Also remember that in order to get the row id to the database id you also have to set DT_RowId otherwise your selectable rows will reset after paginating. I am new to this so it took me hours to realise, hope this helps someone.
This discussion has been closed.