Topic: mdbreact (MDBDataTable) add clickEvent for specific columns expect all

pradip-solace free asked 2 years ago


have added clickEvent in my code fo MDBDataTable. I have some columns in table, I have added clickEvent but it applying for all columns. I need click event for all columns except "addBtn" column. Becausse it is contains buttons - Edit and Delete.

const data = {columns: \[ { label: "First Name", field: "firstName", sort: "asc", width: 150, }, { label: "Last Name", field: "lastName", sort: "asc", width: 150, }, { label: "Email", field: "email", sort: "asc", width: 270, }, { label: "Role", field: "authorities", sort: "asc", width: 200, }, { label: "Contact", field: "phoneNumber", sort: "asc", width: 100, }, { label: "Type", field: "userType", sort: "asc", width: 100, }, { label: "Action", field: "addBtn", sort: "asc", width: 300, },\],

rows: userdData && userdData.length > 0 && userdData.map(rec => { return { firstName: rec?.firstName, lastName: rec?.lastName, email: rec?.email, authorities: rec?.authorities[0], phoneNumber: rec.phoneNumber !== null ? rec.phoneNumber !== null : "", userType: rec?.userType, addBtn: actionButtons(rec, rec?.id), clickEvent: () => handleClick(rec) } }),}

enter image description here



We will think about adding the feature to select specific columns.


pradip-solace free commented 2 years ago

Okay. sure Thanks



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: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: MDB4 5.0.2
  • Device: Laptop
  • Browser: Google Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No