Json - ServerSide - postgresql db
Json - ServerSide - postgresql db
Hello everyone,
I have a table with 5,000 rows of data and 95 columns. However, when I refresh the page, it takes 3.30 minutes for the table to appear. It's not normal for it to take that long. I edit json with serializer. Below you can see a few lines of the code and a json file example. I think the way to reduce this time is to use server-side with php.
https://datatables.net/examples/server_side/simple
I already checked above page. However, I don't know how to convert the code I have into server-side operation. Can anyone help with an idea?
var table = $('#example').DataTable({
// json to fill the table rows and columns.
"ajax": {
url: "/json",
type: "GET"
},
paging: true,
pageLength: 10,
deferRender: true,
{"data":[
{
"id":1,
"p_id_s":"G000001",
"reception_date":"2014-03-27",
"hospital_date":"2014-01-15",
"culture":"MGIT",
"index_sample":"G000001",
"is_index_sample":"Yes",
"status":"Transferred",
"hospital_sample_number":"2013982",
"sample_type":"Sputum",
"inactivation_date":null,
"transfer_date":null,
"comments":null,
"projects":{
"name":"Paris",
"prefix":"P",
"description":""
}
]
}
Answers
I would suggest you look into using our Editor PHP libraries. They are MIT licensed and can be used without needing to use Editor (or having an Editor license). There is a blog post here with further details about how you can use them.
Allan
Hi Allan,
Thank you for the response. I implemented a simple code on Django to try the PHP Editor. However, I am getting the following error. Where am I going wrong, can you help?
**DataTables warning: table id=example - Ajax error. For more information about this error, please see http://datatables.net/tn/7**
model.py
base.html
exampleController.php
config.php
Hi Allan,
Thank you for the response. I wrote a simple code on Django to try the PHP Editor. Although there are entries(rows) in the db, I can't see any data on the screen. Where am I doing wrong?
models.py
base.html
config.php
exampleController.php
I just realized that it gives Not Found: /php/exampleController.php error.
Obviously, I'm typing the extension wrong,
url: "../php/exampleController.php",
but I couldn't find how to get the correct one.
I've never tried running a PHP script with Django. Maybe this SO thread will help. This forum doesn't have the Django expertise to help get this going. However if you have Datatables questions let us know.
Kevin
I hadn't realised you were using Django. The server-side processing protocol is fully documented - it would need a Python implemention to work on a Django server.
Allan