Mani
Mani

Reputation: 169

how to display more that 10000 rows in jquery datatable ,since browser does not responds if it exceeds the limit

i am using below query and initialization code for jquery datatable ,but since the returned rows are more than 5000,browser becomes unresponsive ,i tried using server side option as well,but was not successful,can anyone guide me how to proceed thanks in advance

 $data1 = mysql_query("select b.bcode as bcode,upper(b.bname) as branch,
         upper(st.new_state) as state,upper(b.dist) as dist,sum(a.amt) as amt,
         count(a.amt) as num from mtrans a join ipbs_brmst b on a.brcd=b.bcode 
         and orgdate between '$fdate_new' 
         and '$tdate_new' join state_mapping st on b.state=st.org_state
         group by b.bcode");

while($info = mysql_fetch_array( $data1 )) 
     { 

      $brch = $info['branch'];
      $st = $info['state'];
      $dt = $info['dist'];
      $bcode = $info['bcode'];
      $amt = $info['amt'];
      $num = $info['num'];


     $msg .=  "<tr>";                
     $msg .=  "<td align='left' ><a href=\"mtnx_details.php?b_code=".$bcode."&fdate=".$fdate_new."&tdate=".$tdate_new."\">" . $brch . "</a></td>";
     $msg .=  "<td align='center'>".$st. "</td> ";
     $msg .=  "<td align='center'>".$dt. "</td> "; 
     $msg .=  "<td align='center'>".$num. " </td>"; 
     $msg .=  "<td align='right'>".$amt. " </td></tr>"; 
     } 

   }

        echo $msg;


        ========================

<script>
   $(document).ready(function(){
      $('#Table').dataTable({
          "sPaginationType": "full_numbers"
      });
   });
</script>

Upvotes: 1

Views: 2479

Answers (2)

Prashant Sharma
Prashant Sharma

Reputation: 1

You query is working fine but browser does not support to show large number of data on single page, hence it timed out or break the list. You can use following options: 1) Add filter for data 2) Add pagination 3) Use lazy-load jquery

Upvotes: 0

Tarik
Tarik

Reputation: 11209

Displaying large number of rows in the GUI is bad practice. It's of no use to the user who will never scroll through such huge amount of data. You should instead provide a way to filter the data or present a hierarchy through which the user can drill-down. You can then use jquery to lazy-load the selected detailed data.

Upvotes: 2

Related Questions