[Req] Data Table - Class/Style formatters similar to value formatter #242

Closed
Async0x42 opened this Issue Dec 12, 2016 · 3 comments

Projects

None yet

3 participants

@Async0x42
Async0x42 commented Dec 12, 2016 edited

Can support be added for overriding a cell class/style with a function, similar to the value formatter?

Component support is nice, but for simple cases where we just need to modify the background colour based on a cell value, it's overkill.

i.e.

formatClass (value) {
  switch(value) {
    case 'Ready': return 'green';
    default: return 'red';
   }
}

This would be passed the formatted value as a param, and the return value would be appended to the classes/style config option.

@Async0x42 Async0x42 changed the title from [Req] Data Table - Class/Style transforms similar to value formatter to [Req] Data Table - Class/Style formatters similar to value formatter Dec 12, 2016
@rstoenescu
Collaborator

Will do.

@rstoenescu rstoenescu added a commit that referenced this issue Dec 13, 2016
@rstoenescu rstoenescu feat: #242 Data Table - Class/Style formatters similar to value forma…
…tter

Column configuration "style" and "classes" props can now be methods too,
taking one parameter (value of cell).

Example:
{
  label: 'Message',
  field: 'message',
  classes (val) {
    return val.charAt(0) === 'L' ? 'bg-red' : 'bg-yellow'
  },
  sort: true,
  width: '500px'
}
b8b8487
@rstoenescu
Collaborator
Column configuration "style" and "classes" props can now be methods too,
taking one parameter (value of cell).

Example:
{
  label: 'Message',
  field: 'message',
  classes (val) {
    return val.charAt(0) === 'L' ? 'bg-red' : 'bg-yellow'
  },
  sort: true,
  width: '500px'
}
@rstoenescu rstoenescu closed this Dec 13, 2016
@robsontenorio
robsontenorio commented Dec 31, 2016 edited

@rstoenescu

Is it possible to override default data table css?
Ex: I cant override classes by writing custom css (index.html --> app.css)

Or even add custom css classes like mentioned on previous comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment