Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Toggling nodes and following link
TomCrawford
Junior Member

Posts: 2
Registered: 11/17/2005
Member Is Offline
posted on 11/17/2005 at 10:00 AM Reply With Quote
Toggling nodes and following link


I searched the forum for something relevant but couldn't find anything. I basically wanted to toggle a node when it was selected and also follow the html link for that node, even if the node was deselected (after toggling). I came up with the following, **I want to know if there is a better way that Tigra recommend**:

var TREE_ITEMS = [
['node1','index.html',{'myid':'4'},
['node2','index.html',{'myid':'14'}]],
['node3','index.html',{'myid':'14'}]
];

// styles deleted to save space but you'd need different styles for selected and normal
var TREE_TPL = {
'target' : '_self',
'onItemSelect' : 'id_selected'
};

function id_selected(o_item) {
var id = o_item.a_config[2]['myid'];

if ( o_item.n_state & 4 ) {
id = 0;
o_item.select(true); // Deselects node

// Can do something with the id here, I just set a cookie

document.location = o_item.a_config[1];
return false;
}

// I also set a cookie here

return true;
}
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 11/17/2005 at 10:50 AM Reply With Quote

Try the following code:
Code:

/*
This function modifies tree behavior so nodes will open on single click and then follow the link assigned
Function should be called AS onItemSelect handler of the tree
*/

function onItemSelectHandler (o_item) {
// if node then toggle
if (o_item.a_config[3]) {
o_item.o_root.toggle(o_item.n_id);
}
// proceed to default handler
return true;
}


You could also call the handler on deselect event. Note if only single item could be selected, deselect event will be called automatically.
View User's Profile View All Posts By User U2U Member
TomCrawford
Junior Member

Posts: 2
Registered: 11/17/2005
Member Is Offline
posted on 11/17/2005 at 12:50 PM Reply With Quote

Taken from the Tree Menu Pro help doc:

toggle(n_id) : Toggles the open/close state of item having in a_index array index n_id. No value returned.

I don't want to change the open/close state; I wanted to change the selected state. Your solution doesn't deselect the node when it's selected.

Calling select(b_deselect) on the o_item results in too many recursions.

T
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 11/21/2005 at 12:38 PM Reply With Quote

Please refer to our Customer Care System and submit there a ticket with required functionlity described in details
View User's Profile View All Posts By User U2U Member
APSeabrook
Junior Member

Posts: 5
Registered: 11/8/2005
Member Is Offline
posted on 11/25/2005 at 02:10 AM Reply With Quote
I have a similar issue


This is not an elegant solution but it seems to work.

/*
This function has been modified to display a frames page at the same time as expanding the menu.
*/

function onItemSelectHandler2 (o_item) {
// if node with no link then toggle
if (o_item.a_config[3] && !o_item.a_config[1]) {
o_item.o_root.toggle(o_item.n_id);
// cancel default action
window.parent.TARGET_FRAME_NAME.location='Your_Page.html';
return false;

}
// proceed to default handler
return true;

}


Any comments?
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Tigra Tree Menu
Product Demonstrations Live Demos:
Frames targeting
Win help style
Free Download Free Download
Free Download Menu Builders
Online Builder
Product Documentation Documentation:
Documenation Page
Support Forum Technical Support
Support Forum
   
Tigra Tree Menu PRO
Product Demonstrations Live Demos
Multiple Trees
Frames Targeting
Icons and Styles Overloading
Event Handling
Performance Test
Version 1.2 features
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004