Giter Site home page Giter Site logo

Question - load tree about aspen HOT 3 CLOSED

rodgomesc avatar rodgomesc commented on July 21, 2024
Question - load tree

from aspen.

Comments (3)

zikaari avatar zikaari commented on July 21, 2024 1

If you don't need renaming and file creation capabilities, you can create a basic "filesystem" adapter. TreeModel requires a host with function getItems which will be called initially for the root path, and then later as the user expands directories. The path will be formatted depending on what you specify for pathStyle i.e win32 or unix, latter recommended.

Then you need to rig your getItems callback to translate requested path to actual location of entity in your "object". Probably by traversing recursively and drilling down by each "path segment" until you hit the thing. You can use splitPath from path-fx library to split a path like "/root/Child - 3/Child - 4" to an array of keys like ["root", "Child - 3", "Child - 4"].

Then just walk the keys recursively.


See also:

https://github.com/NeekSandhu/react-aspen-demo/blob/master/demo/index.tsx#L25-L38

https://github.com/NeekSandhu/react-aspen-demo/blob/master/demo/index.tsx#L40

https://github.com/NeekSandhu/react-aspen-demo/blob/master/demo/index.tsx#L70


Basically you should just fork the react-aspen-demo repo to get a boost

from aspen.

zikaari avatar zikaari commented on July 21, 2024

Did this solve your problem?

from aspen.

zikaari avatar zikaari commented on July 21, 2024

Closing due to inactivity

from aspen.

Related Issues (16)

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.