How to open an item in a grouplist programatically

I have 2 group lists next to each other. Both have a list of categories in them. When I select a category in list 1 I want it to open the same categories in list 2 (they have different child lists). I can find the corresponding list item in the other list but I can’t seem to open the item programatically so that the child list shows.

I’m using the following code to try and select the same category in the other grouplist:
(‘category’ is the item value of the selected item in grouplist 1)

$$(“list2”).data.each(function(obj){
if (obj.category == category) {
$$(“list2”).select(obj.id);
return;
}
});

the ‘select’ only highlights the item but does not open it. I did not see a method in the group list to open the item so that the child lists shows.

Is there a way to do this?

Thanks,

I found a way to do this. By showing the first item of the child list of the item I want to open. The ‘each’ function spins thru parent and child lists.

var catfound = false;
$$(“list2”).data.each(function(obj){
// make first child item visible once category is found
if (catfound == true) {
$$(“list2”.showItem(obj.id);
catfound = false;
return;
}
if (obj.category && obj.category == category) catfound = true;
});