muonw / muonw-powertable

▦ PowerTable is a Svelte component that turns JSON data into an interactive HTML table. Inspired by DataTables. Powered by Svelte.
https://muonw.github.io/muonw-powertable/
Other
220 stars 13 forks source link

Hidden column and cell formatting? #11

Closed hsb-tonmoy closed 1 year ago

hsb-tonmoy commented 1 year ago

Hey, first of all, amazing work on this package. Really appreciate it.

I've been reading the docs and I couldn't figure out if there's a way to hide a certain column from displaying and yet use that column's cell value on the corresponding row. Similar to what Grid.js does

Basically, what I'm trying to achieve is that my API returns two keys: first_name, last_name and I'm trying to display that in a full_name column where the value is first_name and last_name combined/formatted.

Thank you again!

muonw-public commented 1 year ago

Hi. Thank you for your inquiry. You can achieve this by modifying the structure of your data before passing it to the component. So, if your API returns first_name and last_name, just create the new key, full_name, and only include that new key in the component's props. That way, as far as the component is concerned, you only have the full_name column, not first_name or last_name.