Is there anyway to suppress the label information on the page length combo box?

Is there anyway to suppress the label information on the page length combo box?

cwelchcwelch Posts: 18Questions: 4Answers: 0

I've got a layout I like, but the labels associated with the page length combo box are quite ugly:

I'd like to suppress the labels or have the labels to the left and right of the box, is it possible?

Here is my java script for the DOM spec:

          var table = $('#instruments').DataTable({
            serverSide: true,
            dom:        'frtp<"bottom"l><"clear">',
            ajax:       "/api/instruments/?format=datatables",
            columns: [
                {data: "name"},
                {data: "ticker"},
                {data: "type"},
                {data: "cusip"},
                {data: "exchange.abbrev"},
                {data: "atr"},
                {data: "active"},
                {
                    data: null,
                    defaultContent: '',
                    className: 'select-checkbox',
                    orderable: false
                },
            ],
            columnDefs: [
                {
                    render: function(data, type, row) {
                        return data.toFixed(2);
                    },
                    targets: 5
                },          
            ],

            buttons: [
                {extend: "create", editor: editor},
                {extend: "edit", editor: editor},
                {extend: "remove", editor: editor}
            ]
        });
        table.buttons().container()
            .appendTo($('.col-md-6:eq(0)', table.table().container()));

Thanks in advance!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    Not sure if I understand what you are asking for but maybe the language.lengthMenu will do what you want.

    Kevin

  • cwelchcwelch Posts: 18Questions: 4Answers: 0

    Specifically I want to suppress the "Show ... entries" labels around the page length selector.

    I previously did have a look at the language.lengthMenu option, but it only allows specification of the content of the page length selector, so it didn't help.

    Thanks for your reply though!

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922
    edited April 2020 Answer ✓

    You mean like this?
    http://live.datatables.net/domejafu/1/edit

    EDIT: I should add this uses the language.lengthMenu option not the lengthMenu option.

    Kevin

  • cwelchcwelch Posts: 18Questions: 4Answers: 0

    Perfect, I miss understood that part of the documentation.

    That is exactly what I'm looking for, thanks for your help!

This discussion has been closed.