Skip to content
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

Table filter for columns containing several filterable items #168

Open
escapingSamsara opened this issue Nov 13, 2023 · 0 comments
Open

Comments

@escapingSamsara
Copy link

Hello,
I am using headless-svelte-tables because I want to utilize the pagination and sorting and filter functionalities which are really nice !

The problem I currently encounter tho is that i have a single column table where each row contains several values i want to be able to filter through.

the table.createColumns looks like so:

 const columns = table.createColumns([
        table.column({
            header: 'Details',
            plugins: {
                sort: {invert: true},
            },
            accessor: row => row, // Access the entire row
            cell: (info) => {
                const {transactionTitle, transactionDate, transactionAmount} = info.value;
                const sanitizedTransactionTitle = sanitizeHTML(transactionTitle);
                return `
                <div>
                    <div>${sanitizedTransactionTitle}</div>
                    <div>Icon | ${transactionDate} | ${transactionAmount}</div>
                    <div>Info</div>
                </div>
            `;
            }
        }),
    ]);
    ```
    
    
    I want to implement a table filter where i can filter the table for rows containing the input strings (so i want the table to be filtered for values of transactionTitle, transactionDate, transactionAmount by entering a string in the search bar. 
    
    how can i achieve this ? i tried to use tableFilter but i just cant make it work
    
    
    
    also i want to be able to sort the table by transactionDate, how would i create a sorting function that tackles this behaviour in the table i am using ? 
    
    
    
    (pagination works just fine)
    
    
    
    thanks in advance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant