showing the paging controls at the top and bottom of the datatable
showing the paging controls at the top and bottom of the datatable
brianbolton
Posts: 4Questions: 0Answers: 0
How do I show the paging controls on the top and bottom of the datatable?
Here's my current configuration:
[code]
var oTable;
var asInitVals = new Array();
$(document).ready(function() {
oTable = $('#bulletinGridSimple').dataTable( {
"aoData": [
{ "sName": "Project" },
{ "sName": "Title" },
{ "sName": "Topic" },
{ "sName": "Subtopic" },
{ "sName": "Published" },
{ "sName": "Release" }
],
"bStateSave": true,
"bProcessing": false,
"bServerSide": true,
"sAjaxSource": "/home/index.cfm/go/bulletin.getBulletins",
"sPaginationType": "full_numbers",
"oLanguage": {
"sSearch": "Search all columns:",
"oPaginate": {
"sFirst": "",
"sLast": "",
"sNext": "",
"sPrevious": ""
}
}
} );
$("thead input").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("thead input").index(this) );
} );
[/code]
Here's my current configuration:
[code]
var oTable;
var asInitVals = new Array();
$(document).ready(function() {
oTable = $('#bulletinGridSimple').dataTable( {
"aoData": [
{ "sName": "Project" },
{ "sName": "Title" },
{ "sName": "Topic" },
{ "sName": "Subtopic" },
{ "sName": "Published" },
{ "sName": "Release" }
],
"bStateSave": true,
"bProcessing": false,
"bServerSide": true,
"sAjaxSource": "/home/index.cfm/go/bulletin.getBulletins",
"sPaginationType": "full_numbers",
"oLanguage": {
"sSearch": "Search all columns:",
"oPaginate": {
"sFirst": "",
"sLast": "",
"sNext": "",
"sPrevious": ""
}
}
} );
$("thead input").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("thead input").index(this) );
} );
[/code]
This discussion has been closed.
Replies
This works:
[code]
"sDom": '<"top"lfip>rt<"bottom"ip<"clear">',
[/code]
You are absolutely correct in that sDom 'could' be used to do this - and will in future! But I'm afraid that this is not currently implemented. It's on my to do list - and is something I would very much like to include in future versions of DataTables, but until then, the way around it is to write a custom pagination function which injects the required controls into the DOM.
Regards,
Allan (wishing there was more hours in the day!)
Is this possible to hide/disable page control and search?
Yes indeed this is possible. To disable the features completely, just use the initialisation feature switch for them: http://datatables.net/usage/features . Or if you want them enabled, but not visible (e.g. so you can use the API functions for them) then just miss that control letter out of sDom.
Regards,
Allan