If there is only one record, but the table info show "entries", is it ok?

If there is only one record, but the table info show "entries", is it ok?

bikaibikai Posts: 21Questions: 12Answers: 0
edited November 2016 in Free community support

If there is only one record, table info might be like this:
Showing 1 to 1 of 1 **entries** (filtered from 57 total entries)
Is it more precise to use "entry" instead of "entries"?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin
    Answer ✓

    You are correct - that would be more correct. There isn't currently a way to give DataTables information about plural values for those variables, although it is something I am aware of and need to improve. I just need to find a good way to do it that will work for all languages and not be seriously confusing to use!

    Allan

  • bikaibikai Posts: 21Questions: 12Answers: 0

    Thanks, allan.

  • sagarbendalesagarbendale Posts: 18Questions: 6Answers: 0

    There might be a better solution:
    But you can achieve this by updating the dataTables.js like below

    function _fnInfoMacros ( settings, str )
        {
            // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only
            // internally
            var
                formatter  = settings.fnFormatNumber,
                start      = settings._iDisplayStart+1,
                len        = settings._iDisplayLength,
                vis        = settings.fnRecordsDisplay(),
                all        = len === -1;
                    if(start === settings.fnDisplayEnd() && start === vis)str=str.replace(/_ENTRY_/g, "entry" );else{str = str.replace(/_ENTRY_/g, "entries" );}
            return str.
                replace(/_START_/g, formatter.call( settings, start ) ).
                replace(/_END_/g,   formatter.call( settings, settings.fnDisplayEnd() ) ).
                replace(/_MAX_/g,   formatter.call( settings, settings.fnRecordsTotal() ) ).
                replace(/_TOTAL_/g, formatter.call( settings, vis ) ).
                replace(/_PAGE_/g,  formatter.call( settings, all ? 1 : Math.ceil( start / len ) ) ).
                replace(/_PAGES_/g, formatter.call( settings, all ? 1 : Math.ceil( vis / len ) ) );
        }
    

    and

    "sInfo": "Showing _START_ to _END_ of _TOTAL_ _ENTRY_",

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin

    Yup - its a good suggestion that, and probably the route that I'm going to take. I'm slightly concerned about languages where the order of the sentence isn't the same as in English, but I don't really have enough domain knowledge about that. As far as I can see, this is the best solution available.

    Allan

This discussion has been closed.