Im using "sDom": 'Rfrtlip' but i can't customize it

Im using "sDom": 'Rfrtlip' but i can't customize it

PepayuPepayu Posts: 4Questions: 2Answers: 0

My js is this:

    new DataTable('#productTable', {
        layout: {
            topStart: {
                buttons: ['pageLength']
            }
        },
        stateSave: true,
        "sDom": 'Rfrtlip',
        bFilter: false

    });

But it is not saving the button-esque style for the page entries, when i tried removing the "sDom": 'Rfrtlip', it shows nice but they are 2 at the top.

I just want a button style at the bottom.

Answers

  • PepayuPepayu Posts: 4Questions: 2Answers: 0

    Fix this by:

        new DataTable('#productTable', {
            layout: {
                bottomStart: {
                    buttons: ['pageLength']
                            }
                },
            stateSave: true,
            bFilter: false
    
        });
    

    and hiding the dt-length

    .dt-length {
        display:none
    }
    
  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    edited November 21

    The layout docs show how to remove unwanted default options. See the default options section. Basically use topStart: null, to remove the page length option instead of using CSS. Either way works but it might be more clear when looking at the code later if you use topStart: null, instead of the CSS.

    Also, as you figured out, the dom and layout options do the same thing so only one of them will work. Not sure without test which will be applied in the case of both being configured.

    Kevin

Sign In or Register to comment.