fiorilli Posted December 19, 2019 Share Posted December 19, 2019 Hello, I am using UniTreeView and I noticed that when check only one of several children the father does not receive a "flag". Would you have any solution for this case? Example Below Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2019 Share Posted December 19, 2019 5 hours ago, fiorilli said: Hello, I am using UniTreeView and I noticed that when check only one of several children the father does not receive a "flag". Would you have any solution for this case? Example Below Hello, I have faced this issue before, but I didn’t save the solution seems. This post may help you: Quote Link to comment Share on other sites More sharing options...
fiorilli Posted December 27, 2019 Author Share Posted December 27, 2019 Hello, thanks for the help. The post that passed me helped a lot. some changes were needed as my tree was over 1 level. I am posting below my code for future reference. javascript: function checkchange(node, checked, e, eOpts) { function SetNodeChecked(mynode, c) { mynode.removeCls('ThirdStateNode'); mynode.set('checked', c); if (mynode.hasChildNodes()) { for (var i=0; i<mynode.childNodes.length; i++) { SetNodeChecked(mynode.childNodes, c);} } }; function setpNodeChecked(node) { function getpNodeChecked(node) {var mynode=node.parentNode; for (var j=0,k=0; j<mynode.childNodes.length; j++) { if (mynode.childNodes[j].data.checked) {k++;}; }; if (k==0) {return 0;} if (k==mynode.childNodes.length) {return 1}; return 3; } if (node.parentNode.data.id!='root') {var pNode=node.parentNode,vv=getpNodeChecked(node); var pp=Ext.get(Ext.getDom(fPerfil.UniTreeView1.id).getElementsByTagName('div')[pNode.data.id]); if (vv==0) {pNode.set('checked',false); pNode.removeCls('ThirdStateNode'); } if (vv==1) {pNode.set('checked',true); pNode.removeCls('ThirdStateNode'); } if (vv==3) {vv=1; pNode.set('checked',true); pNode.addCls('ThirdStateNode'); } setpNodeChecked(node.parentNode); } }; SetNodeChecked(node,checked); setpNodeChecked(node); } css: //Here is inserted a new image that was made based on the unigui standard image located at: FMSoft \ Framework \ uniGUI \ ext-6.7.0 \ build \ classic \ theme-neptune-touch \ resources \ theme-neptune \ images \ form \ checkbox.png .x-tree-checkbox{ background-image: url("../imgs/tree/Terceiro-Estado.png"); } //here is linked to the div of the node representing the button or the new background position. .ThirdStateNode div[role="button"] { background-position: 0 -30px !important; } Final result below. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 27, 2019 Share Posted December 27, 2019 Thank you Quote Link to comment Share on other sites More sharing options...
fiorilli Posted December 30, 2019 Author Share Posted December 30, 2019 On 12/27/2019 at 4:27 PM, Sherzod said: Thank you hello sherzod, after solving this case I came across another problem. This treeview will be used to display the permissions of each user. So when I change a user I need him to load the database information. So I need to check the nodes by code. I try to use JSCallDefer, though, he says he can't find my function. any ideas to solve this case? Examples below: UniTreeView1.JSInterface.JSCallDefer('checkchange', [Node, checked], 20); Taking advantage of the case, I realized that UniTreeNodes has no JSid or JSName, how do I pass them as parameters or do client-side state checks? error image: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.