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

[Feature Request] Show empty/0/null instead of "undefinedundefinedundefined" #74

Open
cvroque opened this issue Apr 20, 2022 · 6 comments

Comments

@cvroque
Copy link

cvroque commented Apr 20, 2022

First of all, thanks for this amazing card. It's the best way to see data between atributes in various entities.

I'm building some cards to check on devices and I end up having issues when these devices don't all have the same atributes. There's the option to use strict: true but I actually want to see all devices. The problem is that makes the table look worse (last column):

image

Now, when it comes to numbers, I managed to fix using the modify argument like this modify: parseInt(x) || 0 and it works:

image

But JS is pretty new to me and I don't know how to make something similar to fix string or dates, or how to just replace "undefinedundefinedundefined" with an empty column. Anyone had similar issues and got tips?

So yeah, my request would be to solve "issues" like this directly in the card.

Thanks in advance!

@daringer
Copy link
Collaborator

yeees, this can be painful and tedious. There is quite some time now a (yet) minimal set of formatters, which you can simply choose for your column to be applied.

See the config reference at the bottom: https://github.com/custom-cards/flex-table-card/blob/master/docs/config-ref.md
And inside the advanced formatting guide is an example: https://github.com/custom-cards/flex-table-card/blob/master/docs/example-cfg-advanced-cell-formatting.md

@cvroque
Copy link
Author

cvroque commented Apr 20, 2022

yeees, this can be painful and tedious. There is quite some time now a (yet) minimal set of formatters, which you can simply choose for your column to be applied.

See the config reference at the bottom: https://github.com/custom-cards/flex-table-card/blob/master/docs/config-ref.md And inside the advanced formatting guide is an example: https://github.com/custom-cards/flex-table-card/blob/master/docs/example-cfg-advanced-cell-formatting.md

Thanks, somehow I missed that. Sadly the formatters don't deal with unavailable data, but I'll try other options with the modify and contribute back at a later time.

@daringer
Copy link
Collaborator

daringer commented Apr 20, 2022

at this point they don't, but there is clearly the plan to allow applying multiple formatters, easily there could be one who hides undefined if encountered...

edit: and btw. not you missed them, moreover they are inside the code for i.d.k. how long and indeed I forgot them until I read you issue and had the fantastic idea to introduce formatters, lol - oh wait, what? I already did, coool!

@cvroque
Copy link
Author

cvroque commented Apr 20, 2022

I ended up using this to change "undefinedundefinedundefined" to empty columns:

modify: if(x.length == 0){""}else{x}

It worked for strings, numbers and date.

image

I'm quite amateur on JS, but maybe this could be added as formatter?

Thanks again!

@bcutter
Copy link

bcutter commented Sep 11, 2022

modify: if(x.length == 0){""}else{x}

That is a great little workaround, glad I found it. Thank you.

@ildar170975
Copy link
Contributor

Then I wonder why this issue is still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants