Please help with displaying large number of records in datatable (100,000 records)

Please help with displaying large number of records in datatable (100,000 records)

rainkvrainkv Posts: 8Questions: 2Answers: 0

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394
    Answer ✓

    Did you enable server-side processing in your DT initialization?
    https://datatables.net/manual/server-side#Configuration

  • rainkvrainkv Posts: 8Questions: 2Answers: 0

    You sympathize but I still do not know how to connect ajax to my database to get data into datatable.
    Can you give more specific instructions for me to get data from 1 table in my sqlsrv database onto datatable?
    Specifically this line: ajax: '/data-source'
    How do I add the source table from my databse here? Many thanks

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    This section of the manual should help.

  • rainkvrainkv Posts: 8Questions: 2Answers: 0
    edited September 2019

    I still couldn't understand the problem because I was new to PHP. Hope the helping.
    This is my connection string.
    `> <?php

    include 'MyConnect.php';

    $connectionInfo = array("Database"=>$dbName,"characterSet"=>"UTF-8", "UID"=>$userName, "PWD"=>$userPassword, "MultipleActiveResultSets"=>true);

    $conn = sqlsrv_connect( $serverName, $connectionInfo);

    if( $conn === false ) {
    die( print_r( sqlsrv_errors(), true));
    }

    $stmt = "SELECT Number_ID,Name FROM DM_Student ";
    $params = array();
    $query = sqlsrv_query( $conn, $stmt , $params );

       ?>
    <style>
      body{
          margin-top: 50px;
          margin-left: 50px;
          margin-right: 50px;
                        background-color: #E0F2F7;
                        font-size: 12px;
                        font-weight: bold;
      }
      .title{
          color:red;
          text-align: center;
          padding-bottom: 20px;
          text-transform: uppercase;
                     }
    

    </style>
    <div class="title">
    <span style="font-size: 32px">LIST STUDEN</span>

    </div>

    <

    div class="col-md-12">

    <?php while($result = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)) { ?> <?php } ?>
    Number Student Name
    <?php echo $result["Number_ID"];?>
    <?php echo $result["Name"];?>
    $(document).ready(function() { $('table.display').DataTable(); ajax: ..., columns: [ { data: 'Number_ID' }, { data: 'Name' }, ] } );

    </body>
    </html>`

This discussion has been closed.