How to remove pagination and "show XX entries"?
How to remove pagination and "show XX entries"?
Hello. I'm using a Wordpress plugin that, from what I understand, uses the functionality of DataTables. It is pretty robust but I struggle to find the right way to accomplish some things, if they are even possible. Here is the shortcode that I'm using in Wordpress:
[gdoc key="https://docs.google.com/spreadsheets/d/1bsFqvYjUeMia_R3chKXMfQwsRtIOuGKZAfpjbHnuAqU/edit?usp=sharing" datatables_dom="lfrtip" datatables_page_length="200" use_cache="no" datatables_paging="no" class="no-responsive"]
Here is the page it is on: http://ovba.org/ogden-valley-businesses-2/
What I'm trying to do is to remove what I don't need. In this case, I'd rather render all the table rows and have no option for the user to choose how many to show and thus also remove the pagination feature.
Any help would be greatly appreciated.
Answers
Hi @johnrhopkins ,
That's all in the
dom
settings - just useCheers,
Colin
To show all rows, set the length to -1:
"pageLength": -1
And to remove the pagination and page length options, adjust the
dom
positioning:https://datatables.net/examples/basic_init/dom.html
and
https://datatables.net/reference/option/dom
Hi @Loren Maxwell ,
The best way to show all rows is to disable paging, so
paging
. That other way might work, but it's not 'official'Cheers,
Colin
Thanks @colin -- you're correct, yours is the better solution!
Thanks you two! This certainly isn't my area of expertise. Here is the shortcode I'm currently using.
[gdoc key="https://docs.google.com/spreadsheets/d/1bsFqvYjUeMia_R3chKXMfQwsRtIOuGKZAfpjbHnuAqU/edit#gid=794123294" datatables_dom="lfrtip" datatables_page_length="100" use_cache="no" class="no-responsive"]
You'll notice that I'm using dom "lfrtip". I'm still getting pagination though. I wish I understood this stuff better. It just isn't something I need very often.
Why? Colin advised "lfrti". Note tha absence of "p" for "paging".
Ah, yes. Thank you. My ignorance. I didn't understand what each of those letters meant.