1

I need to create an application. Which should have tree view. In tree only some of them are draggable.

Most importantly it should have search option.

And it should be clickable and whenever I right click I should get an event to display pop up.

Please suggest me some good Tree view examples available.

raj m
  • 1,863
  • 6
  • 21
  • 37

2 Answers2

0

I'm using this one

https://github.com/frontend-collective/react-sortable-tree

Good one, but I haven't found onItemClick event so Im using addEventListener for that like this

clickEventListenerAdd()
{
  function addEventListenerByClass(className, event, fn) {
    var list = document.getElementsByClassName(className);
    for (var ii = 0, len = list.length; ii < len; ii++) {
      list[ii][event] = fn;
    }
  }

  addEventListenerByClass(
    'rst__rowContents',
    'onclick',
    HANDLE_FUNC
  );
}
Sasha Kos
  • 2,480
  • 2
  • 22
  • 37
  • Yeah I have gone through this. But what about right click on node. – raj m Jul 31 '18 at 05:37
  • I think the same as I shown for `onclick`, but `contextmenu` event https://stackoverflow.com/questions/4235426/how-can-i-capture-the-right-click-event-in-javascript – Sasha Kos Jul 31 '18 at 07:42
0

https://github.com/frontend-collective/react-sortable-tree Refer above link for drag and search filter. It is good to handle everything Please refer below my answer for handling click

  generateNodeProps={clickedNode => ({
      onClick: () => console.log(clickedNode),
  })}
raj m
  • 1,863
  • 6
  • 21
  • 37
  • We can make use of JS contextmenu options.. https://stackoverflow.com/questions/4235426/how-can-i-capture-the-right-click-event-in-javascript – raj m Aug 08 '18 at 08:16