treeList widget ... dynamically check (parent) items

Hello,

I have a small question regarding the tree list widget.
I have a list with child items. If a child is checked I like that the parents are checked dynamically.

image

I have done a event function which changes the data but this don`t refesh the tree conetent:

  var extensionsTreeCheck = function(item) {

    var checkParents = function(parent) {
      parent.selected=true;
      if (parent.hasOwnProperty('parent')) checkParents(parent.parent);
    }

    if (item.hasOwnProperty('parent')) checkParents(item.parent);
  }

So my workaround is this. Reading the tree data with `.data()' and writing it back to the widget.

      .on('treelistselect', function(event, item) {
        if (item.selected) {
            node.extensionsTreeCheck(item);
            extensionData[$('#node-input-exDeviceId').val() || node.exDeviceId] = treeLists[id].treeList('data');
            treeLists[id].treeList('data',extensionData[$('#node-input-exDeviceId').val() || node.exDeviceId]);
        } 
      })

(I have more than one treeList so this is why there is a treelist[id]. And many contexts depending on a select dropdown.)

This works but it is not the best way (I think) as it clears the treeList and redraws it.

Is there a better solution?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.