Closed thelinuxlich closed 1 year ago
Base component :
<script>
import { DataHandler } from '@vincjo/datatables'
import { myJSON } from 'somewhere'
import RemoteSearch from './RemoteSearch.svelte'
import RemotePagination from './RemotePagination.svelte'
const handler = new DataHandler(myJSON, { rowsPerPage: 10 })
</script>
<RemoteSearch {handler}/>
<RemotePagination {handler}/>
RemoteSearch.svelte :
<script>
export let handler
let value = ''
</script>
<input type="text" bind:value on:input={() => handler.search(value)} />
RemotePagination.svelte : DataHandler getters return derived stores that update according pagination state.
<script>
export let handler
const pageNumber = handler.getPageNumber()
const pages = handler.getPages({ ellipsis: true })
</script>
<button on:click={() => handler.setPage('previous')}>
Previous
</button>
{#each $pages as page}
<button type="button"
class:active={$pageNumber === page}
on:click={() => handler.setPage(page)}
>
{page ?? '...'}
</button>
{/each}
<button type="button" on:click={() => handler.setPage('next')}>
Next
</button>
Hmm I don't understand how you're demonstrating a remote data fetch. Ideally, we should pass a option to DataHandler constructor which accepts the URL, and receives the search/filter, sort and page parameters
I did'nt understand your request. This lib only handles client-side interactions with data. No opinion on the data fetching part
I saw this repo recently, which seems to focus on server-side processing https://github.com/Parazeya/svelte-flextable
maybe you will find more answers there
Hmm interesting, why this project looks so similar to yours?
I guess it extends mine ? idk The author clearly started from my code base, including for the documentation site …
Exactly! So weird not giving the credit...
This seems to cross a pretty bright ethical line if not a legal one. I'm happy to post an issue in their repo to at least acknowledge you if nothing else.
You're right, I'll get in touch to clear this up
@vincjo Looks like he/she/they have acknowledged you. What are your thoughts on it?
Hello @riziles I was able to contact the author, who immediately agreed to add the credits. Personally I have no problem with reusing/copying code from this lib. Credits are highly appreciated but not required (unless the documentation site is exactly the same)
I won't be able to respond positively to all feature requests (especially edge cases) to keep things as simple as possible. That's why I have no problem with other developers taking over this project for their needs
Cool. I appreciate that.
An example would be awesome!