Question

>[\] Group
   >[\] Subgroup
      [] Item
      [] Item
      ...
   ...
...

I have tree like demonstrated. [\] implies that it is not selectable, while [] stands for checkbox, which can be selected.

I would like that CLICKING on Group or Subgroup implies:

  • expand of all children below the clicked group/subgroup
  • selection (or when it is second time unselection) of all items below

I would like that clicking on > implies only:

  • expand of all children below the clicked group/subgroup

My code for now looks something like this:

createNode: (event, data) ->
    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) ->
    if data.node.data.k isnt 'c'
        return false

    if data.node.isSelected() and data.node.parent.isSelected()
        return false
click: (event, data) ->
    data.node.visit (child) ->
        console.log data.node.data.k 
        child.makeVisible()
        if child.data.k is 'c'
            child.setSelected(data.node.selected)

and:

ajax: ifModified: true cache: true

checkbox: true
selectMode: 2
debugLevel: 0
generateIds: false

filter:
    mode: 'hide'

For now I have problem that clicking on '>' shows and hides the children below.

How to make properly the check:

event.originalEvent.target is 'fancytree-expander'

This is not working.

Was it helpful?

Solution

This solved my problem:

        tt = $.ui.fancytree.getEventTargetType(event.originalEvent)
        if tt isnt 'expander'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top