Identifying parent nodes in JS

Hello again Jake

In my project I created a JS function that opens another aspx file upon clicking on a node. How ever it triggers the function even if I click on the collapsible handles, I guess I have to tell the JS function to do this action only when clicking the parent or person node.

Is there any example where I could see how to differentiate the parent or person node so the function could fire up when clicking on it instead of the collapsible handle?.

Thanks

LabeledNodeSingleClick assumes the whole bounding box of the node.

and since your collapse handle is within that bounds… it counts as a click to the client side.

sigh. I don’t see a great way to do this. I do see a “hack” that works for DataSetDemo… where the handle is on the left side of the node.

in GoWeb.js, find this code:

function goSearchAt(x, y, a, def) {
if (!a) return def;
for (var i = 0; i < a.length; ) {
var t = a; i++;
if (t == 0) {
if (x >= a && x < a+a[i+2] && y >= a[i+1] && y < a[i+1]+a[i+3])
return a[i+4];
i += 5;
} else if (t == 1) {

and make it this instead…

function goSearchAt(x, y, a, def) {
if (!a) return def;
for (var i = 0; i < a.length; ) {
var t = a; i++;
if (t == 0) {
if (x >= a+6 && x < a+a[i+2] && y >= a[i+1] && y < a[i+1]+a[i+3])
return a[i+4];
i += 5;
} else if (t == 1) {

— the effect of this is it makes the 6 pixels on the left of the node not clickable.

You should be able to see the effect with the hand cursor that pops up over nodes.

I said it was a hack…

now… you could in your own code reproduce the bit of goSearchAt you need to skip just where the handle is in your own SingleClick handler… I think. But that requires you understand the v.Infos array (parameter “a” in the code above).

Ill give it a try

Thanks Jake!