sim-tree icon indicating copy to clipboard operation
sim-tree copied to clipboard

When selected parent element, disabled child nodes are also getting selected

Open raghuveer-kurdi opened this issue 6 years ago • 2 comments

i have below structrue var myData = [{ "id": '1', "pid": '', "name": "Root", "disabled": true }, { "id": '1.1', "pid": '1', // parent ID "name": "Level 1" }, { "id": '1.1.1', "pid": '1.1', // parent ID "name": "Level 2", "disabled": true }, { "id": '1.1.1.1', "pid": '1.1', // parent ID "name": "Level 2" }];

In the above structure, Level 1 can be selectable and Level 2 with id 1.1.1.1 is selectable.

If directly parent node is selected, i.e 1.1, even 1.1.1 obj is getting selected, but it should not as its disabled.

raghuveer-kurdi avatar Apr 04 '19 07:04 raghuveer-kurdi

On the doCheck method of simTree.js file, i have added the below line of code.

@line no 351. if ($li.hasClass('disabled')) return;

This works for me, please review.

raghuveer-kurdi avatar Apr 05 '19 06:04 raghuveer-kurdi

I don't think its a proper fix, it worked initially. But when we have intermediate parents as disabled, but childs are enabled, selection doesn't work properly.

raghuveer-kurdi avatar Apr 05 '19 11:04 raghuveer-kurdi