Git Product home page Git Product logo

Comments (6)

fritz-c avatar fritz-c commented on July 1, 2024 11

I got this request enough that I implemented a fix in v0.1.9. By setting the isVirtualized prop to false, you can draw the tree without react-virtualized.

One thing to note, though. The following functionality worked under the assumption that the tree container would be fixed-height and scrollable, and therefore doesn't work without virtualization:

  • Auto-scrolling while dragging
  • Scrolling to the searchFocusOffset

from react-sortable-tree.

fritz-c avatar fritz-c commented on July 1, 2024

I'm afraid I tied a lot of stuff into the virtualization, such as scrolling when hovering near the edges and scrolling during search. I understand the use for a non-virtualized component is perhaps even greater than that of a virtualized one, but I went with virtualization due to my need to handle large amounts of information at a time.

What I can suggest is a hack on your end to expand the container to the height of your rows. You would change the height with a callback for onVisibilityToggle, something like:

({ treeData }) => {
    changeMyContainerHeight(treeData.length * myTreeRowHeight)
}

You'd also have to decide the initial height based on your tree data.

from react-sortable-tree.

tailsu avatar tailsu commented on July 1, 2024

OK, I get the gist of it. I'll also have to account for collapsed nodes and not add their children into the total height. Thanks for the help!

from react-sortable-tree.

fritz-c avatar fritz-c commented on July 1, 2024

Ah, right, I forgot about that. You could probably use the walk API, set to ignore collapsed nodes, to count it without having to create a recursive function yourself.

from react-sortable-tree.

robhadfield avatar robhadfield commented on July 1, 2024

Not enough praise in this repo for my liking. Well played @fritz-c 👍🏼

from react-sortable-tree.

adyz avatar adyz commented on July 1, 2024

@fritz-c

Awesome stuff with this project!

At the moment this component does not work virtualized since there is an issue with react 17 and I've set isVirtualized to false since I don't really need virtualization for the moment.

This being said, how can I perform a search that can simulate the virtualized experience -- be able to highlight a node, and, if possible, to trigger a scroll to that node.

I've prepared a boilerplate that has the tree and search form instantiated similar to the one in your stories folder

https://codesandbox.io/s/test-react-sortable-tree-issue-yxv23

Is there any way to get the list of found nodes? I've tried the searchFinishCallback but this seems to be fired only on the first render. Is this normal?

from react-sortable-tree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.