K M Rakibul Islam
K M Rakibul Islam

Reputation: 34318

How to get rid of pagination of jQuery Data Table plug-in?

How can I remove the pagination and show features of a jQuery Data Table ? I only want the searching and sorting features of it and want to get rid the other features. Is there any way?

Upvotes: 2

Views: 5750

Answers (2)

Joseph Gabriel
Joseph Gabriel

Reputation: 8510

The sDom option doesn't specifically control pagination. In other words, even with sDom specified, only the first "page" of data is displayed, although all the pagination controls are hidden.

A better way to do this, at least with 1.9x version of DataTables is to specify the bPaginate option.

$(element).dataTable({
    "bPaginate": false
});

This will prevent pagination and will hide pagination controls.

Upvotes: 5

wirey00
wirey00

Reputation: 33661

You can do it like this if you are using without jQuery UI themes

$(document).ready( function() {
    $('#example').dataTable( {
      "sDom": 'frt' // only show search.. processing.. and table
    });
});

http://live.datatables.net/iqewoh/2/edit#preview

with jQuery UI Theme

$(document).ready( function() {
    $('#example').dataTable( {
      "sDom": '<"H"f>rt' // only show search.. processing.. and table
    });
});

<"H"lfr>t<"F"ip> == In header put lfr.. table .. then footer put ip

The following options are allowed:

'l' - Length changing

'f' - Filtering input

't' - The table!

'i' - Information

'p' - Pagination

'r' - pRocessing

The following constants are allowed: 'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')

'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')

The following syntax is expected: '<' and '>' - div elements

'<"class" and '>' - div with a class

'<"#id" and '>' - div with an ID

Default: lfrtip (when bJQueryUI is false) or <"H"lfr>t<"F"ip> (when bJQueryUI is true)

Upvotes: 5

Related Questions