ProIcons   -  Jan 25, 2013

So i was searching about DataTables For Bootstrap ( http://www.datatables.net/blog/Twitter_Bootstrap_2 ) and i ended up that they load Data From Json string. The think is that i have more than 5303 Entries... :/ So in order to load this table it will take a lot of time... So any ideas world?

Examples: http://editor.datatables.net/release/DataTables/extras/Editor/examples/bootstrap.html

Conscious  -  Jan 25, 2013

Do you mean upload to the table (manually) or display information from the table?

ProIcons  -  Jan 25, 2013

I mean to load instantly the data when it change page... with a small limit... exmaple if the table displays 30 rows per time to have SQL Query like LIMIT 1,30 etc...

Conscious  -  Jan 25, 2013

You have a few options; for a small data-set, say, perhaps only 2 pages, you could probably get away with preloading content and switching between them. However, with 5303/30 ≈ 176 pages, you probably won't do that. JSON & a get query is probably the smallest wait time from a user's point of view. Your script could preload the page either side of the current page, perhaps, so the wait time is minimalised when changing pages.

ProIcons  -  Jan 25, 2013

Well is strange but...

5149 Entried Loaded

Page generated in 0.0391 seconds.

<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
require "connect.php";
echo '{
  "id": -1,
  "error": "",
  "fieldErrors": [],
  "data": [],
  "aaData": [';
$query=mysql_query("SELECT * FROM gatherhistory");
$i=1;
while ($g = mysql_fetch_array($query, MYSQL_ASSOC)) {
    $id= $g['GID'];
    $time = $g['DATETIME'];
    $admin = $g['ADMIN'];
    $ip = $g['IP'];
    $map = $g['MAP'];
    $scorea = $g['SCOREA'];
    $scoreb = $g['SCOREB'];
    if ($i > 1) { $string .= ','; }
    $string .= '
    {
      "id": "'.$id.'",
      "time": "'.$time.'",
      "admin": "'.$admin.'",
      "ip": "'.$ip.'",
      "map": "'.$map.'",
      "grade": "X"
    }
    ';
    $i++;

}

echo substr_replace($string ,"",-1);
?>

    ]
}
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
file_put_contents("time.txt","$i Entried Loaded \n\rPage generated in ".$total_time." seconds.");
?>
Hawkee  -  Jan 25, 2013

You could use an infinite scroll to append to the table as you scroll through it. You wouldn't be able to use the real time sorts though. That would have to happen at the server level.

ProIcons  -  Jan 25, 2013

it worked on a very small delay like i said 0.0391 for 5149 entries... so i believe i'm covered for now...

Conscious  -  Jan 25, 2013

That's PHP loading it - what about the USER loading it?

ProIcons  -  Jan 25, 2013

The buffer is filling instantly . Not even wait 1 sec... U can try it if you want, i can provide you link but msg me for that

ProIcons  -  Jan 25, 2013

Actually i can't My project is on my computer, And my computer has a dissfunctional PSU. so i guess at monday...

Conscious  -  Jan 25, 2013

Message me the link when you have it lol

ProIcons  -  Jan 27, 2013

Unfortunately my PSU didn't pass the Warranty... because its over 3 years. so i have to buy a new one... So this may take a while because in Greece we have a lack of Modular PSU's they need to get ordered ... so it will take about 1-7 days.. Damn...

Conscious  -  Jan 27, 2013

[14:07:39.393] GET http://<--censored-->/stats.php [HTTP/1.1 200 OK 12222ms]
It's a 1mb data-set. Now do you see the problem of preloading everything? The page is very, very, very sluggish

ProIcons  -  Jan 28, 2013

So is it possible to load each page everytime? with a Query? :p example to make a query to:

stats.php?page=2 or stats.php?from=1&to=30 etc.?

ProIcons  -  Jan 28, 2013

Well i found a way i will try it and i will respond as soon i have results.

Conscious  -  Jan 28, 2013

Yes, with SQL you can use LIMIT

ProIcons  -  Jan 29, 2013

I Know SQL's Limit but i also need an addon to Datatables to load new data each time i change the page, so Hold it, i may find an allready built-in solution of datatables

Conscious  -  Jan 29, 2013

0.o just use $_GET ?

ProIcons  -  Jan 29, 2013

You don't get it.. Its not about PHP its about AJAX Table... Javascript [Client Side] Like i said i need a table to contain all the data without navigating to other web page...

Conscious  -  Jan 29, 2013

If you're a beginner to javascript, I'd suggest jQuery to make your life easier; Javascript has $.get, and you use that to query a PHP file on your server, which returns the data for page x, then you load that data onto your page

ProIcons  -  Jan 30, 2013

Never said i'm a beginner, but the point is to modify datatable's source Code in order when i'm chaning page to load new data from PHP file with Ajax request... so simple... Or maybe there is a function for that, Thats i'm currently searching for

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.