Displaying data from Datatable is very slow, Why?

Displaying data from Datatable is very slow, Why?

itsursujititsursujit Posts: 2Questions: 2Answers: 0
edited June 2014 in Free community support

For Data table I have used,

$('.individualList').dataTable({
"oLanguage": {
"sSearch": "Search all columns:"
},
"sDom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
"bLengthChange": false,
"sPaginationType": "full_numbers",
"bFilter": false,
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"aaSorting": [[ 2, "desc" ]],
"sAjaxSource": "<?php echo URL.'individual/test/'; ?>",
"aoColumns": [
{ "bSortable": false },
{"sWidth": '180px'},
{ "sType": 'date' },
null,
null,
null,
null,
null,
{ "bSortable": false }
],
"deferRender": true,
"bDestroy": true
});

For Fetching the data from query I have used,

foreach($rResult as $key=>$value)
{
$row = array();
$row[]=$value['ind_id'];
if(checkPermission('individual','G'))
{
$row[]='<a href="'.URL.'individual/view/'.$value['ind_id'].'" class="view">'.str_replace('-',' ', $value['ind_name']).'</a>';
}
else
{
$row[]=str_replace('-',' ', $value['ind_name']);
}
$row[]=date_format(date_create($value['ind_created_date']),'Y-m-d');
$row[]=str_replace('-',' ', $value['ind_father_name']);
$row[]=str_replace('-',' ', $value['ind_spouse_name']);
$row[]=$value['org_name'];
$row[]=$value['ind_designation'];
if($value['ind_is_recepient']=='yes')
{
$row[]=$value['prg_name'];
}
else
{
$row[]='';
}
$act='';
if(checkPermission('individual','E')) //Check permission for edit using session
{
$act .='<a href="'.URL."individual/edit/".$value['ind_id'].'" class="edit" title="Edit Data"><i class="foundicon-edit"></i></a>';
}
if(checkPermission('individual','D'))
{
$act .='<a href="'.URL."individual/delete/".$value['ind_id'].'" class="delete" title="Delete Data"><i class="foundicon-delete"></i></a>';
}
if(checkPermission('individual','A'))
{
$act .='<a href="#" class="indvgrp" rel="'.$value['ind_id'].'" title="Add to Group"><i class="foundicon-people"></i></a>';
}
$row[]=$act;
$output['aaData'][] = $row;
}

echo json_encode( $output );

Here, The display of data is taking more than a minute for 20K records. How can I solve this issue?

This discussion has been closed.