SOW LOAD TIME
SOW LOAD TIME
Much appreciation for this wonderful plugin. I have a web page https://www.edutopia.co.ke/mockform4 containing many several Datatables and getting the data from a php query shown below: I HAVE NOT USED ANY AJAX OR JSON. The tables are too slow.
I understand that converting this query into ajax will enable the"deferRender":true and render perhaps 10 rows at a time.
However, my concern is, if it renders 10 first rows and a table has 8 pages, is it possible to search for an item in, say, row 6 or will the search be possible only on the rendered page?
```while ($row = mysql_fetch_array($query_doc)){
$cost = array();
$NoC =$row['iddocuments'];
foreach ($cost as $row['priceUpdate']){
$cost = array($No => $row['priceUpdate']);
}
if (mysql_result(mysql_query("SELECT `markingScheme` FROM `exampastpapers`"),0) === 0){
$scheme = 'No Marking scheme';
} else {
$scheme = 'With Marking Scheme';
}
$url = mysql_result(mysql_query("SELECT (`materialLink`) FROM `documents` WHERE `iddocuments` = '$NoC'"), 0);
$f = substr($url, strrpos($url, '.') + 1);
include 'fIcon.php';
$cases = mysql_result(mysql_query("SELECT COUNT(`idcomments`) FROM `comments` WHERE `marks` = 0 AND `iddocuments` = '$NoC'"), 0);
if($cases == 1){
$case = "F5F500";
} elseif($cases >= 1){
$case = "red";
} else{
$case = "#6CBB3C";
}
echo '<tr class="datarow" val="898">
<td name= "first">'.$No.'.<br>(Id:'.$row['iddocuments'].')</td>';
include 'nmModal.php';
echo '
<td><font color="'.$case.'">'.$row['penName'].'</font></td>
<td>'.$row['source'].'<br>(Paper '.$row['paper'].')</td>
<td class="fcost"> <b>Ksh.'.$row['priceUpdate'].'</b></td>
<td>'.$row['dateUploaded'].'</td>
<td>'.$row['year'].'<br>'.$row['Paper'].'</td>
<td>'.$row['marks'].'Mks</td>
<td> '.$scheme.'</td>';
$documetId = $row['iddocuments'];
echo
'</tr>';
$No++;
}?> ```
Answers
Hi @Enabla ,
Take a look at the
deferRender
page, it mentions there that when " the end user then sorts, pages or filters the data the rows needed for the next display will be created automatically", so you'll be good.I noticed on your page that all the tables have the same class, "demo", and whenever you initialise the table, you're doing it by class -
I'm not sure, but I suspect, this would slow it down - since jQuery would return all the tables matching that selector. If performance is struggling, it may be better to experiment with unique identifiers on each table, and initialise each specific table with that. for example:
Cheers,
Colin