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

[docs] Needs to inform of modify argument when using scripts as the source #157

Open
giggio opened this issue Dec 8, 2024 · 5 comments
Open

Comments

@giggio
Copy link

giggio commented Dec 8, 2024

I found about modify in the issues, but the docs don't show it:

``` yaml
type: custom:flex-table-card
title: Script Example
service: script.test_response
entities: []
columns:
- name: Name
data: family.name
- name: Birth Year
data: family.year
```

Also, x is also not documented.

@EdLeckert
Copy link
Contributor

The Script Example above does not need the modify option. The modify option is optional. But if it did use it, it would be used the same as in other examples.

Note that the documentation is a little ahead of the latest release, specifically regarding the use of data and modify as selectors in complex structures. This is an unfortunate limitation of GitHub.

The value x contains the cell contents, and JavaScript is used to alter it in some way. For example:

modify: x * 10

would multiply the cell's contents by 10.

Does that help?

@giggio
Copy link
Author

giggio commented Dec 8, 2024

Yes, but it should be in the docs.

It didn't work for me without modify, but you're saying in the next release it will?

@EdLeckert
Copy link
Contributor

Sorry, you're right. I didn't look at the example carefully enough...been staring at the screen too much this weekend.

You do need the modify option as of the latest release.

Current release:

   - name: Name 
     data: family
     modify: x.name

Next release (hopefully):

   - name: Name 
     data: family.name

I say hopefully because I am not the code owner, so I don't control releases. But the change has been accepted and is already in the master branch along with the matching docs, which is why the docs shown by github are confusing. (You can always grab the flex-table-card.js file from master if you want to jump ahead.)

@giggio
Copy link
Author

giggio commented Dec 8, 2024

Ok, so the problem is that the docs are not in sync with the latest release, but with the master branch. This is understandable, but it is a bug in the docs, you can see how this is confusing. The docs probably should update only when a release is made.

Regarding x, it is not in the docs at the moment, and it seems it should be.

I'll keep this issue open, as there is work to be done, maybe when the next release comes out then it can be closed.

@daringer
Copy link
Collaborator

aaahh indeed this is pretty bad - aiming for a release this weekend [tm]

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

3 participants