|
50 | 50 | optionsComponent, // Custom component to render in the last column
|
51 | 51 | defaultPageSize = 10, // Default page size - number of rows to display per page
|
52 | 52 | toggle = false, // Whether to display the fitToScreen toggle
|
| 53 | + search = true, // Whether to display the search input |
53 | 54 | pageSizes = [5, 10, 15, 20], // Page sizes to display in the pagination component
|
54 | 55 | fitToScreen = true, // Whether to fit the table to the screen,
|
55 | 56 | exportable = false, // Whether to display the export button and enable export functionality
|
|
154 | 155 | // Render the cell with the provided component, or use the toStringFn if provided, or just use the value
|
155 | 156 | cell: ({ value, row }) => {
|
156 | 157 | return renderComponent
|
157 |
| - ? createRender(renderComponent, { value, row }) |
| 158 | + ? createRender(renderComponent, { value, row, dispatchFn: actionDispatcher }) |
158 | 159 | : toStringFn
|
159 | 160 | ? toStringFn(value)
|
160 | 161 | : value;
|
|
319 | 320 |
|
320 | 321 | // Format server columns to the client columns
|
321 | 322 | if (response.columns !== undefined) {
|
322 |
| - console.log(response); |
323 |
| -
|
324 | 323 | columns = convertServerColumns(response.columns, columns);
|
325 | 324 |
|
326 | 325 | const clientCols = response.columns.reduce((acc, col) => {
|
|
369 | 368 | {#if $data.length > 0 || (columns && Object.keys(columns).length > 0)}
|
370 | 369 | <div class="table-container">
|
371 | 370 | <!-- Enable the search filter if table is not empty -->
|
372 |
| - {#if !serverSide} |
| 371 | + {#if !serverSide && search} |
373 | 372 | <form
|
374 | 373 | class="flex gap-2"
|
375 | 374 | on:submit|preventDefault={() => {
|
|
386 | 385 | id="{tableId}-search"
|
387 | 386 | /><button
|
388 | 387 | type="reset"
|
| 388 | + id="{tableId}-searchReset" |
389 | 389 | class="absolute right-3 items-center"
|
390 | 390 | on:click|preventDefault={() => {
|
391 | 391 | searchValue = '';
|
|
396 | 396 | </div>
|
397 | 397 | <button
|
398 | 398 | type="submit"
|
| 399 | + id="{tableId}-searchSubmit" |
399 | 400 | class="btn variant-filled-primary"
|
400 | 401 | on:click|preventDefault={() => {
|
401 | 402 | $filterValue = searchValue;
|
|
405 | 406 | </form>
|
406 | 407 | {/if}
|
407 | 408 |
|
408 |
| - <div class="flex justify-between items-center py-2 w-full"> |
| 409 | + <div class="flex justify-between items-center w-full {search && 'py-2'}"> |
409 | 410 | <div>
|
410 | 411 | <!-- Enable the fitToScreen toggle if toggle === true -->
|
411 | 412 | {#if toggle}
|
|
0 commit comments