Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Async0x42 opened this issue Dec 12, 2016 · 4 comments
Closed

Comments

@Async0x42
Copy link

Async0x42 commented Dec 12, 2016

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 [Req] Data Table - Class/Style transforms similar to value formatter [Req] Data Table - Class/Style formatters similar to value formatter Dec 12, 2016
@rstoenescu
Copy link
Member

Will do.

rstoenescu added a commit that referenced this issue Dec 13, 2016
…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'
}
@rstoenescu
Copy link
Member

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'
}

@robsontenorio
Copy link

robsontenorio commented Dec 31, 2016

@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?

@solovieff
Copy link

So, this was removed in v1? ):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants