Board Logo

Control bg on open item
DWice - 12/1/2006 at 10:38 AM

menu items:

Item 1 (has url, no children)
Item 2 (has url, no children)
Item 3 (no url, has children)
Item 3.1 (has url)
Item 3.2 (has url)
Item 3.3 (has url)

Item 3 is set to be open on menu build.

I want to be able to show a bg color on Item 3 when users navigate 3.1, 3.2, etc, but to disappear when users navigate to Item 1 or 2. The state of Item 3 appears to open, not open & selected, which makes sense since it has not been clicked.

Hope this makes sense.

David


tigra - 12/2/2006 at 12:27 AM

you can modify the tree's behavior in the handler of the open event. In the handler call .select() method and then return true to proceed to default onItemOpen handler.


DWice - 12/5/2006 at 12:54 PM

I created the following function and tied it to the onItemOpen event.

function test(o_item){
var a_parent = o_item.o_parent;
if(a_parent.n_id == 5) {
a_parent.select();
}
return true;
}

It did nothing, even if I added alerts to it. Using the example below, I was clicking on 3.1, 3.2, etc...so figured since these are leaf items, they don't have an open event. I moved my function to the onItemSelect, and it then appeared to run (alerts showed), but the parent.select did not happen.
I am expecting that .select() will select the item as if I clicked on it. Is this correct?

When I click on it manually with my mouse, the background shows. I know the id (5) is correct.

Thanks for any suggestions.

David


tigra - 12/5/2006 at 02:00 PM

submit a support ticket attaching your files in the zip archive. We'll take a look. The problem may have something to do with multiple selections option.


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/