zTree_v3 icon indicating copy to clipboard operation
zTree_v3 copied to clipboard

Toggle checked on <li> click

Open kidach opened this issue 11 years ago • 3 comments

Great plugin btw :) I want to toggle checked, when i click on span that is inside

  • For example, when i check on name of first child(of parrent :)) i want to toggle checked. I hope you understand me :) Tnx.
  • kidach avatar Nov 12 '14 10:11 kidach

    oh, It's so easy.

    Please use the callback.onClick. when user click the node's name, zTree will trigger this function.

    In this function, you can check the node with 'checkNode()' function.

    zTree avatar Nov 12 '14 10:11 zTree

    When you say callback onClick, i need to add to settings callback: { onClick: myFunction } And in myFunction to toggle checked? Maybe i am trying to implement this plugin to fast, i need to check API better :)

    kidach avatar Nov 12 '14 12:11 kidach

    yes, in myFunction, you can get the ‘treeId’ & ‘treeNode' parameters ....so you can use

    treeObj.checkNode(treeNode, !treeNode.checked);
    

    please check the API & Demo

    zTree avatar Nov 13 '14 00:11 zTree