title: how to distinguish expand vs click in fancytree?
body: <pre><code>&gt;[\] Group
     &gt;[\] Subgroup
        [] Item
        [] Item
        ...
     ...
  ...
  </code></pre>
  
  <p>I have tree like demonstrated. <code>[\]</code> implies that it is <strong>not</strong> selectable, while <code>[]</code> stands for checkbox, which can be selected.</p>
  
  <p>I would like that <strong>CLICKING</strong> on Group or Subgroup implies:</p>
  
  <ul>
  <li>expand of all children below the clicked group/subgroup</li>
  <li>selection (or when it is second time unselection) of all items below</li>
  </ul>
  
  <p>I would like that clicking on <code>&gt;</code> implies only:</p>
  
  <ul>
  <li>expand of all children below the clicked group/subgroup</li>
  </ul>
  
  <p>My code for now looks something like this:</p>
  
  <pre><code>createNode: (event, data) -&gt;
      kind = data.node.data.k
      pk = data.node.data.i
  
      if objects?[pk]
          data.node.setSelected()
  
      if kind isnt 'c'
          $(data.node.li).find('span.fancytree-checkbox').remove()
  
  beforeSelect: (event, data) -&gt;
      if data.node.data.k isnt 'c'
          return false
  
      if data.node.isSelected() and data.node.parent.isSelected()
          return false
  click: (event, data) -&gt;
      data.node.visit (child) -&gt;
          console.log data.node.data.k 
          child.makeVisible()
          if child.data.k is 'c'
              child.setSelected(data.node.selected)
  </code></pre>
  
  <p>and: </p>
  
  <p>ajax:
          ifModified: true
          cache: true</p>
  
  <pre><code>checkbox: true
  selectMode: 2
  debugLevel: 0
  generateIds: false
  
  filter:
      mode: 'hide'
  </code></pre>
  
  <p>For now I have problem that clicking on '>' shows and hides the children below.</p>
  
  <p>How to make properly the check:</p>
  
  <pre><code>event.originalEvent.target is 'fancytree-expander'
  </code></pre>
  
  <p>This is not working.</p>