{hero}

language.entries

Since: DataTables 2.0

Replacement pluralisation for table data type.

Description

DataTables displays information text about the table in a number of locations - the table information control and paging control for example. This option makes it possible to customise the string shown in each for the data type being shown, also taking into account the pluralisation of the data.

For example, without this option, DataTables will show:

  • 10 entries per page for the page length control, and
  • Showing 1 to 1 of 57 entries for the information control.

Using this option the entries can be customised without modifying the rest of the strings. This can be really helpful as your users will know at a glance what the data type is in the table. For example, you might have a list of people whereby the following strings would be a better fit for the table:

  • 10 people per page
  • Showing 1 to 1 of 57 people.

While desirable that level of customisation isn't normally performed on a table due to the repetition of the main strings. This option is designed to address exactly that and also the pluralisation aspect of these fields.

When given as an object, you can provide keys to match a specific number with _ as the "wildcard". For example for a table of team members you might use:

entries: {
    _: 'team members',
    1: 'team member'
}

For more information on the pluralisation object structure, please see i18n().

This option will currently have an impact on the language strings noted in the "related" section below.

Type

This option can be given in the following type(s):

Default

  • Value: {_: 'entries', 1: 'entry'}

Example

Change the entries type to 'people':

new DataTable('#myTable', {
	language: {
		entries: {
			_: 'people',
			1: 'person'
		}
	}
});

Related

The following options are directly related and may also be useful in your application development.