Akshat Amrit Akshat Amrit - 9 days ago 6
Javascript Question

Change sinfo message with number of entries

I'm new to datatables. I want to customize sinfo message from "Showing START to END of TOTAL entries" to "Showing START to END of first 1000 entries", if the total number of entries exceed 1000. and if the total number of entries is less than 1000 then it should display "Showing START to END of TOTAL entries". I'm using datatable in salesforce.
How can I achieve this?

Answer

I was able to sort it out by calling infoCallback function in table's js file.

$("#example-table").dataTable({ "infoCallback": function( settings, start, end, max, total, pre ) { if (total == 0) { start = 0; } if (total > 999) { return "Showing " +start +" to "+ end + " of first 1000 entries"; } else { return "Showing " +start +" to "+ end + " of "+total +" entries"; } },

Comments