I'd like to be able to display the sum of values in a table's selected cells. However, the native Table component appears to not support multi-cell selection. I don't suppose anyone has found a suitable workaround or solution for such a thing.
Best I can do currently is accumulate selected cells and then map reduce them to display a sum. However, the "selected cell" styling sort of "pops out" the currently selected cell so it's difficult to read or select its nearest neighbors. Anyone know if the selected cell styling can be changed or removed? I would just add a dynamic cell style based on its existence in my accumulator. I run this query on cell select events:
Last thing I'll say is that I can call table14.clearSelection() after accumulating the selected cell, so at least it goes away. This is a very hacky solution to something that I would think be natively supported.
Hi there,
you're correct, the table doesn't support multi-cell selection but does support multi-row. You could calculate the selected rows for the column(s) you're interested in and display them that way. It sounds like you've already found a workaround that does something similar though.
Hi, thanks for your suggestion. The desired functionality is similar to spreadsheet applications where highlighting some number of cells displays a naive sum. In my case I also have to dynamically style the selected cells and do color blending on conditionally highlighted cells. I have something that's working more or less, but native support for multi-cell selection would be nice.
I understand. There's a different mindset between a spreadsheet and a Retool App and sometimes it can feel frustrating that components have been designed for a different purpose than you want them to be.
There's a great article about making them "feel" more like a spreadsheet, if that's still your intention, well worth a read.
Big plus one to what @dcartlidge shared above! There's often a tendency or desire to interact with Retool tables the same way we'd interact with a spreadsheet, but they serve different purposes. That said, I've bumped an internal conversation about implementing multi-cell selection and will provide an update here as soon as possible.