-
Notifications
You must be signed in to change notification settings - Fork 46
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
[Svelte] Table does not consider key property #191
Comments
This is an interesting point. Honestly, the const headerWithCustomSortFunction = headers.find(
(h) => h.key === sortingKey && !!h.sortFn
); But I think you make a good point that if you've bothered to add I really wish we were already ported to Typescript for Svelte (on the horizon); because I'm trying to think about the case where the data is inconsistent with itself e.g. I see some possible cases:
Perhaps we don't need to solve for 3. at all and can just do case 1. and case 2. which would certainly be an enhancement over what's there today; and log a separate ticket or do a separate iteration for the proper error handling. Thoughts? @zonradkuse Is this something you'd be interested in tackling yourself were you just reporting? We'd be gracious if it's the former 😉 but also graciously accept a valid issue as too 😄 lmk Marking as both a bug and enhancement as this is sort of a mix of both :) |
Also @zonradkuse if you're interested I've just started https://gitter.im/AgnosticUI/contribute a few days back and I'm down to chat over some of these things. I'm hit and miss whether in there but I get email notifications and pop in a few times daily. |
I see! I believe that this is a naming issue as key is ambiguous in this context. I thought key was meant exactly for that and I wasn't aware it is for sorting (I did not see this in the docs, this doesn't mean it is not there, though). I retrieve data from an API endpoint where I can not guarantee the order of the elements. Depending on the backend, the order depends on the dictionary implementation or their serialization. So, the feature would be awesome to have. You raise a valid point in case 3. I believe, a cleaner API design could use another property I have to think about this for a bit. It's pretty late here already. For now I have a rather dirty 3-minute 6 LOC solution:
Right now, I have more work on my desk than I am able to tackle and my js is a bit rusty. I can give it a go but can't promise any results in the next few weeks. It does not seem to be that complicated, though. |
I can go ahead tackle this as I think it'd be pretty simple, this would also open the door for more selective data visibility, so if the table is supplied data with a key not present in the headers, it can simple be ignored, this is actually an issue I ran into initially when using the table |
Thanks y'all @Croug 🙏 |
Thank you! :-) |
@Croug Is this something you think you'll be able to tackle still? I know you're busy w/the exam prep. |
Yup I can still tackle this, I'll be finishing up my cert here in the next few days and I'll have plenty of time then if I don't get to it before then |
This blocks #213 which should probably come right after (we can port to other frameworks after the Astro hackathon project is submitted) |
@zonradkuse my understanding is that #197 already addresses this but we just want to add a storybook story to confirm. But, if this is a blocker for you feel free to cherry-pick that in and confirm it works on your end. I think that PR is slated to land soon though — thanks for bearing with us! |
Describe the bug
It seems like the order of the headers matters and that the respective key property is not used to select the cells. See the following snippet to illustrate the problem.
To Reproduce
Here an example snippet
This results in the following table:
Expected behavior
The snippet should result in
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: