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

Question: How to add hover effect on each cell separately? #930

Open
samuk190 opened this issue Apr 19, 2024 · 2 comments
Open

Question: How to add hover effect on each cell separately? #930

samuk190 opened this issue Apr 19, 2024 · 2 comments

Comments

@samuk190
Copy link

image
I want something like this it is possible?

@abhijain1705
Copy link

can i try working on this?

@niranjan821
Copy link

niranjan821 commented Aug 14, 2024

You can use itemRenderer and use mouse events to detect mouse hover.

eg:
`itemRenderer = ({ item, timelineContext, itemContext, getItemProps, getResizeProps }) => {
const { left: leftResizeProps, right: rightResizeProps } = getResizeProps();
const backgroundColor = itemContext.selected ? (itemContext.dragging ? "red" : item.selectedBgColor) : item.bgColor;
const borderColor = itemContext.resizing ? "red" : item.color;
return (
<div
{...getItemProps({
style: {
backgroundColor: 'green',
color: item.color,
borderColor,
borderStyle: "solid",
borderWidth: 1,
borderRadius: 4,
borderLeftWidth: itemContext.selected ? 3 : 1,
borderRightWidth: itemContext.selected ? 3 : 1
},
onMouseDown: () => {
console.log("on item click", item);
},
})}
onMouseEnter ={ () => {
console.log('Hovering on item ->', item);
}}
>
{itemContext.useResizeHandle ? <div {...leftResizeProps} /> : null}

    <div
      style={{
        height: itemContext.dimensions.height,
        overflow: "hidden",
        paddingLeft: 3,
        textOverflow: "ellipsis",
        whiteSpace: "nowrap"
      }}
    >
      {itemContext.title}
    </div>

    {itemContext.useResizeHandle ? <div {...rightResizeProps} /> : null}
  </div>
);

};`

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

3 participants