Topic: MDBDataTable
Erupendra free asked 6 years ago
Hi,
1. I want to change length from 10 to 20 records per page in MDBDataTable. Is there any options to change default value?
Jakub Mandra staff answered 6 years ago
Hi there,
You cant pass event handlers to rows, but you can add Button.
const data = { columns: [ { label: "Name", field: "name" }, { label: "Position", field: "position" }, { label: "Action", field: "action" } ], rows: [ { name: "Tiger Nixon", position: "System Architect", action: <Button onClick={this.clickHandler}>Action</Button> }, { name: "Garrett Winters", position: "Accountant", action: <Button onClick={this.clickHandler}>Action</Button> }, { name: "Ashton Cox", position: "Junior Technical Author", action: <Button onClick={this.clickHandler}>Action</Button> } ] };
Erupendra free answered 6 years ago
I created rows and columns array to pass data fields.
Example :
const data = {
columns: [
{
label: 'Name',
field: 'name'
},
{
label: 'Position',
field: 'position'
}
],
rows: [
{
name: 'Tiger Nixon',
position: 'System Architect'
},
{
name: 'Garrett Winters',
position: 'Accountant'
},
{
name: 'Ashton Cox',
position: 'Junior Technical Author'
}
]
}
I want to set onClick method to each row so that I will be able to get dynamic data when user click on row. How can I pass onClick event and function to rows.
Thanks in advance.
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: Free
- Premium support: No
- Technology: MDB React
- MDB Version: 4.7.1
- Device: Web
- Browser: Chrome
- OS: Linux
- Provided sample code: No
- Provided link: No
Tags
Anna Morawska staff commented 6 years ago
Hi there,
Unfortunately this is not possible for now, but thank you for bringing our attention to that. We will add it to our TODO list, and try to implement it until the next release.
Best,
Ania
Erupendra free commented 6 years ago
Thank you Ana for your quick response.
ayswarya free commented 4 years ago
hi is that possible now?
Piotr Glejzer staff commented 4 years ago
Do you mean something like that?
<MDBDataTable entriesOptions={[ 5, 10, 15 ]} />