Clear selection TreeSelect

UI Components for React
Post Reply
marciohsilva
Posts: 3
Joined: 22 Mar 2021, 22:03

24 Jan 2023, 21:10

Hello, what would be a way out to clear the selection of a TreeSelect with selectionMode "single"?

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

26 Jan 2023, 00:30

Just set the selection back to null.

Code: Select all

const [selectedKey, setSelectedKey] = useState(null);

<Tree value={nodes} selectionMode="single" selectionKeys={selectedKey}>
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests