Server-side pagination with DataTable 1.9 and Twitter Bootstrap 2
Server-side pagination with DataTable 1.9 and Twitter Bootstrap 2
Hi there,
I've had great success with hooking DataTables up with Twitter Bootstrap following the instructions @ http://datatables.net/blog/Twitter_Bootstrap_2. However, I am having no such luck with server-side pagination. Can someone look over this and tell me what I'm missing?
My code looks like this:
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sAjaxSource": "http://localhost/js/test.js"
} );
} );
Rendering engine
Browser
Platform(s)
Engine version
CSS grade
Loading data from server
Rendering engine
Browser
Platform(s)
Engine version
CSS grade
[/code]
When I load it, I get an error:
[quote]DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0[/quote]
I have a static JS file I'm using to test available at http://localhost/js/test.js (creating the JSON isn't a problem - this is just a test file):
[code]
{
"sEcho": 1,
"iTotalRecords": "57",
"iTotalDisplayRecords": "57",
"aaData": [
[
"Gecko",
"Firefox 1.0",
"Win 98+ / OSX.2+",
"1.7",
"A"
],
[
"Gecko",
"Firefox 1.5",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 2.0",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 3.0",
"Win 2k+ / OSX.3+",
"1.9",
"A"
],
[
"Gecko",
"Camino 1.0",
"OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Camino 1.5",
"OSX.3+",
"1.8",
"A"
],
[
"Gecko",
"Netscape 7.2",
"Win 95+ / Mac OS 8.6-9.2",
"1.7",
"A"
],
[
"Gecko",
"Netscape Browser 8",
"Win 98SE+",
"1.7",
"A"
],
[
"Gecko",
"Netscape Navigator 9",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Mozilla 1.0",
"Win 95+ / OSX.1+",
"1",
"A"
]
]
}
[/code]
If anyone has any tips, they'd be greatly appreciated!
I've had great success with hooking DataTables up with Twitter Bootstrap following the instructions @ http://datatables.net/blog/Twitter_Bootstrap_2. However, I am having no such luck with server-side pagination. Can someone look over this and tell me what I'm missing?
My code looks like this:
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
"sAjaxSource": "http://localhost/js/test.js"
} );
} );
Rendering engine
Browser
Platform(s)
Engine version
CSS grade
Loading data from server
Rendering engine
Browser
Platform(s)
Engine version
CSS grade
[/code]
When I load it, I get an error:
[quote]DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0[/quote]
I have a static JS file I'm using to test available at http://localhost/js/test.js (creating the JSON isn't a problem - this is just a test file):
[code]
{
"sEcho": 1,
"iTotalRecords": "57",
"iTotalDisplayRecords": "57",
"aaData": [
[
"Gecko",
"Firefox 1.0",
"Win 98+ / OSX.2+",
"1.7",
"A"
],
[
"Gecko",
"Firefox 1.5",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 2.0",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 3.0",
"Win 2k+ / OSX.3+",
"1.9",
"A"
],
[
"Gecko",
"Camino 1.0",
"OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Camino 1.5",
"OSX.3+",
"1.8",
"A"
],
[
"Gecko",
"Netscape 7.2",
"Win 95+ / Mac OS 8.6-9.2",
"1.7",
"A"
],
[
"Gecko",
"Netscape Browser 8",
"Win 98SE+",
"1.7",
"A"
],
[
"Gecko",
"Netscape Navigator 9",
"Win 98+ / OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Mozilla 1.0",
"Win 95+ / OSX.1+",
"1",
"A"
]
]
}
[/code]
If anyone has any tips, they'd be greatly appreciated!
This discussion has been closed.
Replies
Allan
[quote]Does it work on first load and then not subsequently?[/quote]
Nope - it fails with that error on the first attempt. Even though it's static, it should render the first page of results... right?
Allan