Comments (5)
Hi, here attached with my setup for ajax without server side processing for configuration.
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/fixedcolumns/3.2.4/js/dataTables.fixedColumns.min.js"></script>
$(document).ready(function() {
$('#table_merchant_list').DataTable( {
"order": [[ 0, "asc" ]],
"pageLength": 5,
"scrollX": true,
"fixedColumns": {
leftColumns: 2
},
// "bProcessing": true,
// "bServerSide": true,
"sAjaxSource": "test/jxindex",
"columns": [
{ data: "id" },
{ data: "name" },
{ data: "city" },
{ data: "tel" },
{ data: "email" },
{ data: "contact" },
{ data: "created_date" },
{ data: "status" },
{ sortable: false, "render": function ( data, type, full, meta ) {
var rowID = full["id"];
return '<a href=/contacts/'+encodeURI(rowID)+' class="btn btn-info">Edit';
}
}
]
} );
} );
function jxIndex($request, $response)
{
$config = array(
'host' => 'localhost',
'port' => '3306',
'username' => 'xxx',
'password' => 'xxx',
'database' => 'xxx' );
$dt = new Datatables( new MySQL($config) );
$dt->query("
Select
id, name, city, tel, email, contact, created_date, status
FROM
contact
");
echo $dt->generate();
exit();
}
what i see here is, retrieve whole chunk of data instead of process the parameters from ajax to retrieve require data. So maybe can include in next update.
from datatables.
by turning off this two make it processing by datatables without server side support, which way is better? server side produce require data or give a large chunk of data and let datatables process it?
$('#table_merchant_list').DataTable( {
// "bProcessing": true,
// "bServerSide": true,
...
});
from datatables.
Can you show me your setup? Which version of datatables do you use?
Sorting and pagination etc. must work as expected.
from datatables.
@irvine48 Server side is better when you have to display a lot of results from an expensive query (mysql or another). You will be able to recover only the elements to be displayed according to the pagination parameters (start and length) sent during the server request.
On the other hand if you have little data to display, the client side does the job very well.
For your problem, I think you use incompatible datatables lib version (< 1.10). Try to use last stable version from offical website https://datatables.net/download/
from datatables.
"bServerSide": true,
you should enable this. Otherwise whole data will be loaded.
your setup looks ok to me.
from datatables.
Related Issues (20)
- extender export button HOT 1
- adapter for eloquent
- update CI 3 example
- CI 3 with hooks error
- another eample
- empty dataset
- How to include in project without Composer
- Which method adds optional parameters to the row? HOT 1
- Multiple value coloumn order HOT 2
- Add support for Embedded DataTable from Editor HOT 1
- Conditional where clauses for PhalconAdapter HOT 1
- MySQL error on special column names HOT 5
- addIndexColumn / DT_RowIndex
- Laravel adapter does not work with PostgreSQL
- PhalconAdapter not working
- Export to Excel feature HOT 1
- datatable: data with function, doesn't work sort HOT 1
- Problem when using sql server in codeigniter 4 adapter HOT 2
- data as array are forbidden
- Skip Total Records HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatables.