Topic: How to enter entriesOption via data-mdb ?

launchbrigade priority asked 2 years ago


I have tried :

data-mdb-entriesOptions="[5, 10, 25, 50]"

and

data-mdb-entriesOptions="5, 10, 25, 50"

neither seems to work. is this even possible? do I have to initialize via javascript ?


launchbrigade priority commented 2 years ago

Actually even using javascript doesn't work:

        const advancedData = {
            columns: [
                { field: 'title', sort: true, format: formatTitle },
                { field: 'department', sort: true, format: formatDept },
                { field: 'location', sort: true, format: formatLoc  },
            ],
            rows: myobj,
            entries: 5,
            entriesOptions: [5, 10, 25, 50],
            borderless: true,
        };

        const instance = new mdb.Datatable(document.getElementById('datatable'), advancedData);

Michał Duszak staff answered 2 years ago


Hello, it looks like you're trying to define options in a data object. Third parameter of datatable's constructor is options, so it looks like this:

new mdb.Datatable(document.getElementById('datatable'), advancedData, {
            entries: 5,
            entriesOptions: [5, 10, 25, 50],
            borderless: true,
})

Here is a snippet: https://mdbootstrap.com/snippets/standard/m-duszak/3784983#js-tab-view



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No