glide-data-grid icon indicating copy to clipboard operation
glide-data-grid copied to clipboard

Is it possible to add icons in the first column and bind events to them?

Open 851091009 opened this issue 2 years ago • 5 comments

image

851091009 avatar Aug 31 '23 13:08 851091009

you want these in the row marker?

jassmith avatar Aug 31 '23 15:08 jassmith

you want these in the row marker?

Yes, it would be great if it could be implemented. This way, other operations can be performed. For example, clicking on the icon can trigger a pop-up editing box.

table-icon

851091009 avatar Sep 01 '23 00:09 851091009

I see... uh... I mean... I wouldn't hold your breath. I definitely love this concept but I dont see me doing it for a bit. It's not that hard really if someone wants to contribute.

jassmith avatar Sep 01 '23 17:09 jassmith

Depending on the difficulty I could maybe PR this if no one else is picking it up. Ideally it would be its own prop so that you can show a custom node there with an onClick handler, since I believe you can only render down raw HTML strings into the canvas (but let me know if this is right or not...)

How's this API?

rowMarkerButton={{
  html: `<svg></svg>`,
  onSelect(rowIndex) {

  }
}}

Not exactly sure what the internals of the sheet look like, but I think that would satisfy the case for the most part. It wouldn't add support for things like the Tooltip shown in OP's post, but that would require executing some React code (or some other event handlers on the row marker element). We could implement this the way the hasMenu prop in column headers is implemented if the logic is easy to copy. That said, I'd need some guidance from @jassmith, as I'm not familiar with the internals.

nandorojo avatar Sep 04 '23 18:09 nandorojo

I've added all the bits required to make this possible in 6.0.0. I think the last bit now is someone to brainstorm what the api for this should be. Row markers are automatic currently... so thats a bit of an odd one.

jassmith avatar Dec 21 '23 06:12 jassmith