Git Product home page Git Product logo

Comments (12)

larsts avatar larsts commented on July 18, 2024

Hi,

I'm sure fritz-c can elaborate here, but as far as I know you would need to create your own noderenderer to disable the moving functionality. Check out the nodeContentRenderer option.

As for adding buttons, check out the generateNodeProps option and how this is configured in the included example (src/examples/basicExample/app.js)

from react-sortable-tree.

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

Thank you @larsts.
As larsts said, the example code is a good place to look for the button adding example.

As for disabling moving, I don't have an official way to do it, but the hack explained here might do what you want for now: #14 (comment)

from react-sortable-tree.

clifflo avatar clifflo commented on July 18, 2024

By the way I have written a typescript definition for your library, so should I make a pull request for you then? Also @fritz-c do you mind let me write the disabling moving for you, perhaps I could clone your repository and then write up a new prop of enable/disable the handle bar.

Also for the length of individual tree node if the text is too long would it wrap? I have tested but I find that it is not able to do so.

from react-sortable-tree.

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

I've not used typescript before, so I'm not exactly sure how it works, but if it will benefit other users of the library I'll merge it in.

As for the move disabling, I would be interested in adding a new prop for it. A moveDisabled prop that disables the rendering of the handle (and adds an extra rowContentsMoveDisabled class to replace the missing border on the left side of the node) is basically what I had in mind.

Text wrapping is not possible right now, at least not in the automatic, browser-handled sense. If you made the rowHeight prop tall enough, and added <br /> or some sort of pre style to your text, you could pull it off, but automatic resizing due to height is disabled in favor of using react-virtualized. If you search "react-virtualized" in the issues you can find a few discussions on this matter.

from react-sortable-tree.

clifflo avatar clifflo commented on July 18, 2024

So now for the typescript definition should I make a pull request then?

from react-sortable-tree.

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

Sure, that would be great!

from react-sortable-tree.

clifflo avatar clifflo commented on July 18, 2024

Thanks Chris. So I assume that I would firstly fork your project and then add the relevant typescript definitions to a new folder and then compare to your master branch making a pull request, is that right?

from react-sortable-tree.

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

I'm not sure how typescript definitions work, so I can't comment on the folder part of it, but the rest of that regarding the pull request is correct.

from react-sortable-tree.

rgrohitg avatar rgrohitg commented on July 18, 2024

Hi,

is the moveDisabled props is added in the latest release?

from react-sortable-tree.

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

This functionality is now available with the canDrag API in version 0.1.14.

from react-sortable-tree.

thidasapankaja avatar thidasapankaja commented on July 18, 2024

Is there a way to disable the specific nodes only rather than disabling the drag on entire tree

from react-sortable-tree.

gaeundev avatar gaeundev commented on July 18, 2024

Is there a way to disable the specific nodes only rather than disabling the drag on entire tree

My case was only disabled on the root node, and I used it as below

<SortableTree
   {...props}
   canDrag={({treeIndex) => treeIndex>0}
/>

image

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.