remove has_children and change id for a row using element

I have a treegrid, but the XML data can have circular references in it, which although correct for my system, causes problems when dynamically loading data for a row that appears twice. This is because, in the XML data, the parent node is referred to by its id, so the treegrid doesnt know which row to open or close, causing strange results.

I have created a script to loop through the new rows and check existing rows to see if the item already exists, but I cannot find a way of changing the new rows attributes has_kids and id, so that it stops the user clicking on it to open it.

This is the code I have trouble with. Its located in a onXLE event, so the duplicate has already been rendered.

mygrid._h2.forEachChild(parent_id,function(element){ var found=false; if(element.has_kids) { for(iterator=0;iterator<kids_list.length;iterator++) { if(kids_list[iterator]==element.id) { // disable element and kids found=true; element.has_kids=undefined; // doesnt remove the '+' open node element.id=''; // works but sets ALL nodes with id of element.id to '' break; } } if(!found) { kids_list.push(element.id); } } });

kids_list is an array of rows with children (created before loading the data)
element.id is the id value of the row (not unique) e.g. Jon
element.has_kids is either undefined or true

so we have the following logical process:-
Loop through each of the new children,
If the entry ‘has children’, then loop through the list of previous rows that ‘have children’ (created before loading)
if the new entry already exists in the tree then disable the new row (somehow?)
if the new entry doesnt exist, then add it to the list

problem: how to disable a row so you cant open it, using element, without it effecting other rows with the same id?