0

I am using react-table-sticky to make my columns sticky, now I am trying to add styles (border-right) to table elements which are sticky. When I inspect sticky elements, they don't have specific classnames for sticky elements but instead data-sticky-td="true". I can't find a way to add styles only to them. You can see my code sandbox sample here

Kaung Khant Zaw
  • 1,508
  • 3
  • 19
  • 31

1 Answers1

0

Updated:

I added a classname by checking if that cell has a sticky value and it works.

                ..
                  {row.cells.map((cell) => (
                    <TableCell
                      {...cell.getCellProps()}
                      className={`${
                        cell.column.sticky === "left"
                          ? "left-sticky-cell"
                          : cell.column.sticky === "right"
                          ? "right-sticky-cell"
                          : ""
                      }`}
                    >
                      {cell.render("Cell")}
                    </TableCell>
                  ))}
                 ..

Kaung Khant Zaw
  • 1,508
  • 3
  • 19
  • 31