Open NothingFiner opened 3 weeks ago
@NothingFiner interested in submitting a PR?
@melloware I would be, but I would also like to know if there's a preference for if it would be better to update the interface, add a new interface, or look into why it might be different more.
If it's the last option, I will need some time! I could also update the docs to show how to use template in this manner.
I'm not sure if this kind of functionality is supposed to be deprecated or what, but this is not accurate.
in reality it takes a string or an options object
If you update the .d.ts
files it automatically updates the website docs you pointed to. So if you modify to PaginatorTemple | string
it will just show up.
@NothingFiner another user just reported this in #7319 ?
Describe the bug
it's quite easy to work around this issue by using any or writing one's own interface. However, I noticed that the options object passed to paginator templates from a data table does not match the interface provided. options object:
interface provided:
Specifically, a lot of the keys that are supposed to be at root level are nested inside of props object. My best guess is that this is an oversight, but I don't know to what else it might relate. It could be that there's some sort of bifurcation between the pagination component and its use here. I would be happy to work up a PR for this if there is not an issue.
This is also the case with other template options--ie the other elements of the paginator.
Reproducer
No response
System Information
Steps to reproduce the behavior
ref={dt} loading={isFetching} value={data?.products || []} dataKey='id' paginator={data?.products?.length > 12} rows={12} onSort={sortHandler} sortField={dataTableSort.sortField} sortOrder={dataTableSort.tableSortOrder as 1 | 0 | -1} rowsPerPageOptions={[12, 24, 36]} paginatorTemplate={{ LastPageLink: LastPageLinkTemplate, layout: 'RowsPerPageDropdown PrevPageLink FirstPageLink PageLinks LastPageLink NextPageLink', }} pageLinkSize={3} emptyMessage='No products found.' sortIcon={SortIconTemplate}
and a template something like this
`const LastPageLinkTemplate = (options: any) => { debugger;
return ( <button type='button' onClick={options.onClick} className='text-gray-500'
PaginatorLastPageLinkOption
interface.Expected behavior
the options object passed to the template should match the provided interface