Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Attributes in MDBDataTable not working?

Mike.Thomson free asked 5 years ago


*Expected behavior*API Documentation for MDBDatatable (Data Structure) refers to the ability to define attributes as a collection. I would like to add a class to cells that can be controlled with CSS (eg: To align text to right). For Example

{
        name: 'Ashton Cox',
        position: 'Junior Technical Author',
        office: 'San Francisco',
        age: '66',
        date: '2009/01/12',
        salary: <div class='float-right'>$86</div>,
        attributes: {
          class: 'xxx',
        }
      },

*Actual behavior*When resulting code is inspected in chrome developer tools, no attributes are assigned to <td> elements. Note: I have also tries className instead of class.

Perhaps there is a better way to assign custom styles to <td> elements, rather than include html in the field value - very cumbersome when data is being read from a large data source via ajax?

Resources (screenshots, code snippets etc.)


Mike.Thomson free commented 5 years ago

Still waiting for response - Anyone?


Jakub Chmura staff answered 5 years ago


Hi @Mike.Thomson,

Our documentation describes only attributes for columns. Currently, a way to add attributes to one separate cell table as you show in your code example is not possible.

I think it's a good idea to provide that feature in the near future, so I add the task to our feature list.

If there is anything else I could do for you do not hesitate to ask me. I'll be happy to help you.

Best Regards,

Kuba


Mike.Thomson free commented 5 years ago

That would be good. It is very inefficient currently to have to reiterate the data object to add any keyclick handling, remove null values or apply any html to each element. By allowing class attribute to be assigned then CSS can be used, but it would also be nice if there was a template that could be specified for each column.


Jakub Chmura staff commented 5 years ago

@Mike.Thomson sure, you're right. We try to add this feature in the near future.

Best, Kuba


toni@sopro.io free commented 4 years ago

Hi, I have the same problem have you maybe implemented this feature?


Piotr Glejzer staff commented 4 years ago

We didn't yet. I don't see this task on our list, somebody removes it or didn't be put., I added again to add that feature.



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: 4.23.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: Yes
  • Provided link: No