Pager Type Default

Pager Type Default

REJISREJIS Posts: 15Questions: 4Answers: 0

Why was the default of this changed to Full Numbers when Simple Numbers already always shows the first and last numbers that can be clicked making the First and Last buttons not needed? I personally like the smaller arrows for Next and Prev without the text, but the testers are flipping out on the big change.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    You can trivially change it back with the options (or set a default if you have multiple tables). Rightly or wrongly I felt it make the control more complete and easier to use. I can see the point of view that it has introduced redundancy though.

    Allan

  • REJISREJIS Posts: 15Questions: 4Answers: 0
    edited October 16

    I did end up defining some defaults for this and other things that changed like Printing suddenly including footer, and something changed in the code where things that are CSS media print hidden(display none) aren't considered anymore and I had to actually block the class instead. The main thing is things like this pager change and even most of the defaults I set along with properties like dom are marked as deprecated, so will be forced come Version 3.

    // DataTables 2+ Defaults
    if (DataTable && DataTable.defaults) {
        if ("language" in DataTable.defaults === false) DataTable.defaults.language = {};
        DataTable.defaults.language.emptyTable = "No records found";
        DataTable.defaults.language.lengthMenu = "_MENU_ Entries per page";
        DataTable.defaults.pagingType = "simple_numbers";
    }
    
    $.extend($.fn.dataTable.ext.buttons.print, {
        "exportOptions": { "stripHtml": false, "columns": ":not(.noPrint)" },
        "footer": false
    });
    
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Its a balancing act. I want to keep driving the software forward and that does mean changing things in major versions now and then. But at the same time, I know all to well how annoying changes can be at times. Sorry it has caused some extra work for you.

    Allan

  • REJISREJIS Posts: 15Questions: 4Answers: 0
    edited October 21

    What does the columns in exportOptions look at? The "columns": ":not(.noPrint)" works sometimes for me, but not all the time. I have some tables where the checkboxes don't print and some where they do. All the td tags including the header have the noPrint class, but it is still printing them. I think the developers that did the code for our print button change to the button bar were thinking it wouldn't print things hidden with the media print css of display none that class applied when we had a Print button on its own on the page. Maybe DataTables 1.x copied the noPrint over or something and it didn't print then (Just confirmed this and it does copy noPrint in v1, but not v2). I guess my testers never tested/noticed the Excel button either because it outputs an empty column there for the checkbox column in DT version 1 and 2, but they entered a bug for me saying that version 2 broke it.

    It looks like the class of checkboxes were chk-select in Version 1, but dt-select-checkbox in version 2. About half our pages use the default checks which would have their classes updated to the version 2 class, but the other half we rendered real checkboxes and gave them the version 1 class. Is there a way to tell it not to print/export the checkbox column? It looks like exportOptions has a format with a child of body I saw mentioned once. It seemed to pass the column index, data, and a third param that might have been the API/Table. If I could somehow detect if select is enabled and hide the first column it may work, but I don't know if that could be done with extend like I'm defining the defaults.

  • kthorngrenkthorngren Posts: 21,317Questions: 26Answers: 4,948

    What does the columns in exportOptions look at?

    See this example. It states that is supports the options documented in the column-selector docs.

    The "columns": ":not(.noPrint)" works sometimes for me, but not all the time.

    This test case works with "columns": ":not(.noPrint)":
    https://live.datatables.net/soquwero/1/edit

    Can you provide a link to a test case showing where this doesn't work?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    but they entered a bug for me saying that version 2 broke it.

    Not sure I understand you problem description. Please provide a test case showing the issue.

    Is there a way to tell it not to print/export the checkbox column?

    See the first replay and column-selector options. If you have issues with this please provide a test case showing what you have so we can offer suggestions.

    It looks like exportOptions has a format with a child of body I saw mentioned once.

    Not sure what you are referring to. Do you have more details?

    If I could somehow detect if select is enabled and hide the first column it may work, but I don't know if that could be done with extend like I'm defining the defaults.

    I think the easiest way is to use a classname to define the columns to hide. Using this example the class dt-select is applied to the select checkbox column. For this case use columns: ':not(.dt-select)', for example:
    https://live.datatables.net/divizore/1/edit

    Kevin

Sign In or Register to comment.