Change table_info depending on table.page() & table.page.len()

Change table_info depending on table.page() & table.page.len()

nwickinwicki Posts: 21Questions: 8Answers: 0

Hi

I am trying to change the text below the data table which is normally something like:
"Showing 1 to 10 of 57 entries"

To manually adjust the text I want to do something like:
'language': {
'info': 'Showing ' + ((table.page()-1)*table.page.len()+1) + ' to ' + (table.page()*table.page.len()) + ' of ' + table.totalRecords + ' entries'\n
}

Since the table itself is just about to be defined I cannot access the page field, and I do not know how I can access the information otherwise.

Do any of you know how to solve this?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    See here, you can use macros.

    Colin

  • nwickinwicki Posts: 21Questions: 8Answers: 0

    How can I use them in computations? The macros apparently substitute substrings with the according value, but I don't see how I can use them.

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Ah, I see. You would do that in the draw, and just over-write the existing string in the element - something like this.

    Colin

  • nwickinwicki Posts: 21Questions: 8Answers: 0

    With the approach of overwriting 'div.dataTables_info', we overwrite the datatables_info of every table on the same page. How can I change the info of a specific table?

  • nwickinwicki Posts: 21Questions: 8Answers: 0

    Nevermind, got it.

This discussion has been closed.