jQuery UI Widgets Forums TreeGrid Would love to brainstorm solutions for: TreeGrid.

This topic contains 1 reply, has 2 voices, and was last updated by  admin 1 week, 3 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • vitorio
    Participant

    How can I expand or collapse all rows in jqxTreeGrid programmatically in React?


    admin
    Keymaster

    Hi,

    Please, find an example below:

    import React, { useRef } from "react";
    import JqxTreeGrid from "jqwidgets-scripts/jqwidgets-react-tsx/jqxtreegrid";
    
    export default function App() {
      const treeGridRef = useRef(null);
    
      const expandAll = () => {
        treeGridRef.current.expandAll();
      };
    
      const collapseAll = () => {
        treeGridRef.current.collapseAll();
      };
    
      return (
        <div>
          <button onClick={expandAll}>Expand All</button>
          <button onClick={collapseAll}>Collapse All</button>
    
          <JqxTreeGrid
            ref={treeGridRef}
            width={800}
            source={dataAdapter}
            columns={columns}
          />
        </div>
      );
    }

    Best regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.