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

useCustomCells removed in v6?

Open UberMouse opened this issue 1 year ago • 4 comments

Upon attempting to upgrade to v6 I've noticed that useCustomCells is no longer exported from @glideapps/glide-data-grid. I don't see any mention of this removal anywhere, or any indication what to use instead

UberMouse avatar Jan 28 '24 22:01 UberMouse

This change with v6: You can just provide a list of custom cells to use in the customRenderers props. Or you can import all via:

import { allCells } from "@glideapps/glide-data-grid-cells"

 <DataEditor
      # ... other props,
      customRenderers={allCells}
 />

lukasmasuch avatar Jan 29 '24 20:01 lukasmasuch

So instead of doing

    const customCellsArgs = useCustomCells([ButtonCell, RangeCell]);

     <DataEditor
       ref={gridRef}
       {...customCellsArgs}
      />

You now just do

     <DataEditor
       ref={gridRef}
       customRenderers={[ButtonCell, RangeCell]}
      />

UberMouse avatar Jan 29 '24 20:01 UberMouse

Yep, I believe that should work. Also, see the comment here on how you can use a custom drawing.

lukasmasuch avatar Jan 29 '24 20:01 lukasmasuch

Ok thanks :) I'll give the upgrade another go when I get a chance. v6 looks nice :)

UberMouse avatar Jan 29 '24 20:01 UberMouse