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] Ability to pass rows type as an TS Interface/Type. #28

Closed
tawfiek opened this issue Mar 2, 2022 · 5 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@tawfiek
Copy link
Collaborator

tawfiek commented Mar 2, 2022

Make table configuration accepting a typescript interface to strongly typed rows data,
This might add some flexibility and confidence while loading data to the table, and also make it easier to manipulate data in the tables.

@tawfiek tawfiek changed the title Ability to pass rows type as an TS Interface/Type. [Feature Request] Ability to pass rows type as an TS Interface/Type. Mar 2, 2022
@uap-universe
Copy link
Collaborator

uap-universe commented Mar 28, 2022

In my current project we have a huge typed abstraction for the smart table settings. But for the original settings, though.

I am too reluctant to provide this as a pull request here, because it is very specific and tends to cover only the settings we actually use in our project. Also, we implemented it as a layer on top of the (previously) untyped settings and after migrating to this fork, we just changed that layer to be compatible with this fork.

In our settings, functions like valuePrepareFunction are statically typed as well as the column properties. So let's say you have an object

class Foo {
   bar: number
   baz: boolean
}

You would create smart table settings like this

settings = {
    // ...
   bar: {
       // bar column settings
   },
   baz: {
       // baz column settings
   }
}

Our implementation checks that you spell the property names correctly, and also checks that the type in the column settings is compatible. We also have helper functions makeTextColumn, makeNumberColumn, makeEnumColumn etc. that spare you the verbose and repetitive definition of column settings.

It is possible that I gradually formulate pull requests for these features some time in the future. But again, they are very specific and very custom so maybe it would be wise to just provide them as an add-on layer (as it is right now) because I do not want to force everybody to think they way we did in our project.

@uap-universe uap-universe added the enhancement New feature or request label Mar 28, 2022
@tawfiek
Copy link
Collaborator Author

tawfiek commented Mar 28, 2022

It would be nice of course, if we had a look at your abstraction, Maybe we can came up together with something more generic starting with your team's abstraction.

In my codebase we have tons of repetitive tables settings in various components, Hopefully I can contain this amount of code by migrating to this fork soon.

@dj-fiorex
Copy link
Owner

Please @uap-universe try to share as much as you can, because i think that your solution is good to eliminate an all kind of problems working with the table! Thanks

@uap-universe
Copy link
Collaborator

relates to #65

@uap-universe
Copy link
Collaborator

I am using a very old management trick and close this ticket in favor of continuing the discussion in #127. This way it looks like we are not sleeping on the job 😆😆

@uap-universe uap-universe added duplicate This issue or pull request already exists and removed enhancement New feature or request labels Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants