dj-fiorex / angular2-smart-table

Angular 2 Smart Data Table component
https://dj-fiorex.github.io/angular2-smart-table/
MIT License
51 stars 22 forks source link

Add documentation about how to use the valueStoreFunction #164

Open uap-universe opened 1 week ago

uap-universe commented 1 week ago

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 https://github.com/dj-fiorex/angular2-smart-table/issues/127#issuecomment-2388715451

uap-universe commented 1 week ago

@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

onavatte commented 4 days ago

That helped a lot. Thank you very much.