Our blazing fast Grid component built with pure JavaScript


Post by Stormseeker »

I was wondering if there is a way to specify a css style or class per row based on the data for that row. I didn't see anything in the docs or in the examples. Something similar to getRowClass if you are familiar with another framework. =)

Post by mats »

We don't have this yet but there's a feature request open: https://github.com/bryntum/support/issues/285

For now you can do what want in the column#renderer method since it gives you access to the row. Docs: https://bryntum.com/docs/grid/#Grid/column/Column#config-renderer

Post by Stormseeker »

Ah, I totally missed that prop in the renderer function. That should work nicely for now, thanks!

Post by jhill@achieveit.com »

For anyone else that stumbles across this thread, you can now do something like this:

{
    field: 'name',
    type: 'name',
    text: 'Name',
    renderer: ({ value, row }) => {

  if (someBoolCondition) {
    row.addCls(styles.someClassName); // css modules syntax; plain classname works too
  }

  return value;
},

Post Reply