-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
feat: add DataTable display and sort methods #352
feat: add DataTable display and sort methods #352
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/carbon-svelte/carbon-components-svelte/k29fd5tfm |
@@ -231,7 +241,9 @@ | |||
dispatch('click:cell', cell); | |||
}}" | |||
> | |||
<slot name="cell" row="{row}" cell="{cell}">{cell.value}</slot> | |||
<slot name="cell" row="{row}" cell="{cell}"> | |||
{headers[j].display ? headers[j].display(cell.value) : cell.value} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the display
method be accessed this way—referencing the original headers
array—or by passing it to the cells object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you have is good
const sortHeader = writable({ | ||
id: null, | ||
key: null, | ||
sort: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should sort
be initialized with null
instead of undefined
, like the other sortHeader
properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! This feature makes the DataTable
very flexible.
Now, you'd be able to:
- customize display/sorting per header as needed
- customize cell value with markup/components using named slots
Can't wait to start using this.
fixes #282