Pagination / Four-button / Option / Conditionally Display/Suppress text labels

Pagination / Four-button / Option / Conditionally Display/Suppress text labels

netaisllcnetaisllc Posts: 24Questions: 2Answers: 0
edited April 2014 in DataTables 1.9
Hi Allan,

I was wondering if you have ever fielded this request:
When using 4-button pagination, I'd like to communicate FIRST, LAST, NEXT and PREV with icons.
Is there a way to tell the plugin to refrain from injecting the equivalent text strings?

(Yeah, I know I can target the anchor tags with Jquery and omit the text - shown below - but that feels like a bad surgeon wielding an axe.)
[code]
// See if full number pagination has been elected
var _p = $('.dataTables_paginate.paging_full_numbers');

// Remove Next/Previous text
if ( _p.length ) {
// Reselect to get only anchors without spans which hold page numbers
// That is, we want only First, Previous, Next and Last.
$('.dataTables_paginate.paging_full_numbers > a').text("");
};
[/code]

Replies

  • netaisllcnetaisllc Posts: 24Questions: 2Answers: 0
    I found a very workable solution, so sorry for the trouble!

    The solution is to use, in the table configuration object, the Language Configuration options like so:

    [code]
    oLanguage: {
    oPaginate: {
    "sFirst": "",
    "sLast": "",
    "sNext": "",
    "sPrevious": ""
    }
    },
    [/code]

    This results in the same outcome but is much less brutal. :)
  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Yup - that's what I would suggest. Then add the images using a splash of CSS :-).

    Allan
This discussion has been closed.