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

Add documentation about how to use the valueStoreFunction #164

Closed
uap-universe opened this issue Oct 5, 2024 · 2 comments
Closed

Add documentation about how to use the valueStoreFunction #164

uap-universe opened this issue Oct 5, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation ng2-smart-table-migration An issue that arised when migrating from the original ng2-smart-table to this fork.
Milestone

Comments

@uap-universe
Copy link
Collaborator

uap-universe commented Oct 5, 2024

Yes, indeed. I think the examples need some cleanup in general. I'll create a task for it.

Regarding your migration: have you already seen this page in the documentation?

https://dj-fiorex.github.io/angular2-smart-table/migration

If you find anything that should be added here, it would be much appreciated. Currently this is just a loose collection of things I remembered from my migration, but there might be several important things missing.

I'm currently doing a migration from ng2-smart-table and I'm struggling with the newValue property which has become private and the setValue which only accepts the string type. I think I'm not the only one. I'm not sure to understand the use of valueStoreFunction to fix this as well.
So I think a short chapter on this subject in the migration guide would be appreciated.

Originally posted by @onavatte in #127 (comment)

@uap-universe uap-universe added documentation Improvements or additions to documentation ng2-smart-table-migration An issue that arised when migrating from the original ng2-smart-table to this fork. labels Oct 5, 2024
@uap-universe
Copy link
Collaborator Author

uap-universe commented Oct 5, 2024

@onavatte just to help you out real quick, until I find the time to write something about it in the documentation.

The valueStoreFunction is supposed to be the inverse of the valuePrepareFunction.

While the valuePrepareFunction converts the data value of any type to a string, the valueStoreFunction will receive the string and is supposed to convert it back to the correct type that is used by the data structure.

So for example when you have a field in your object start_date: Date the

  • valuePrepareFunction would format that date to a string (e.g. ISO-8601)
  • valueStoreFunction would parse the formatted string to a Date object

@onavatte
Copy link

onavatte commented Oct 9, 2024

That helped a lot. Thank you very much.

@uap-universe uap-universe added this to the v3.4.0 milestone Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation ng2-smart-table-migration An issue that arised when migrating from the original ng2-smart-table to this fork.
Projects
None yet
Development

No branches or pull requests

2 participants