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

[feat]: DataTable Columns (ColumnDef) doesn't support passing of any state/functions #3608

Open
2 tasks done
sagar-jani opened this issue Apr 26, 2024 · 0 comments
Open
2 tasks done

Comments

@sagar-jani
Copy link

Feature description

I have actions in data-table - copy, I want to show different icon to user when user clicked on the action. However i can't define any state inside columns.

Here is what I want to do

  const copyToClipboard = async () => {
    try {
      await navigator.clipboard.writeText(loan.accountno);
      setIsCopied(true);
      setTimeout(() => setIsCopied(false), 2000);
    } catch (err) {
      console.error('Failed to copy text: ', err);
    }
  };


    <DropdownMenuItem className="cursor-pointer" onClick={copyToClipboard}>
      {isCopied ? (
        <CopyCheckIcon className="h-4 w-4" />
      ) : (
        <CopyIcon className="h-4 w-4" />
      )}
      Copy
    </DropdownMenuItem>

Affected component/components

No response

Additional Context

Additional details here...

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues and PRs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant