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: Combat those disappearing icons
kozman
Member

Posts: 15
Registered: 4/10/2003
Member Is Offline
posted on 10/22/2003 at 02:32 AM Reply With Quote
Combat those disappearing icons


I found that in IE browsers, if you set the cache to "Every Visit to Page", the tree icons would disappear once in a while.

I believe the reason for this was that I was calling a javascript function as a link
(ie. ["Node","javascript:fx(arg1,arg2)"]) and the target window was set to "_self".


Either way, here are some options to create a more predictable tree control:

1. Set the browser cache to "Automatic" (Not realistic if you need to support any browser configuration)

2. Don't use the link field for javascript calls. Use the events instead (ie. ["Node",null,{'hs':'MyFx'}])

** BONUS **
If solution 2. just isn't good enough and you need to pass arguments into MyFx() (As I had to do), then the above syntax won't work for you. The tree control always sticks "(this)" onto the end of the 'hs' definition thus causing a javascript error when run. Here's a way to get around that:

["Node",null,{'hs' : 'MyFx(arg1,arg2)+DummyFx'}]

What this does is create the following javascript that gets evaluated by the tree control (essentially concatenating the return values of MyFx() and DummyFx())

var ttmp0 = MyFx(arg1,arg2)+DummyFx(this);

DummyFx would be declared as a no-op function:

function DummyFx() {}
View User's Profile View All Posts By User U2U Member
PinkFloydEchoes
Junior Member

Posts: 5
Registered: 11/7/2003
Member Is Offline
posted on 11/7/2003 at 09:55 PM Reply With Quote
Wow!!


kozman i like you style and i am having the exact same problem and your solution was almost perfect. i implemented it exactly like shown and it works, so i set the link field back to null.

but it still tries to load null in a new window after it gets through executing my function.

any ideas?
View User's Profile View All Posts By User U2U Member
kozman
Member

Posts: 15
Registered: 4/10/2003
Member Is Offline
posted on 11/12/2003 at 07:27 PM Reply With Quote

"null" can be fickle at times as a link value...It all depends on your situation...What I traditionally use is "javascript:void(0)". This will guarantee that your link is now interpreted as "dead" by the browser and you won't run the risk of getting a blank page in the browser.

["Node","javascript:void(0)",{'hs' : 'MyFx(arg1,arg2)+DummyFx'}]
View User's Profile View All Posts By User U2U Member
epotvin
Junior Member

Posts: 6
Registered: 10/21/2003
Member Is Offline
posted on 11/26/2003 at 06:14 PM Reply With Quote

I did exactly what you said, but I have a problem.

Here is a sample line of my tree_items.js

Code:

['111211 - Culture de pommes de terre', 'javascript:void(0)', {'hs' : 'ajouterScian(111211, 1)+bidon'}],


and here are the two functions called :

Code:

function ajouterScian(codeScian, nbFeuilles) {

choix = true;

if (nbFeuilles >= 5) {
choix = confirm("Selectionner ce code ajoutera " + nbFeuilles + " offres. En etes-vous sur?");
}

if (choix == true) {
document.location = 'ajouterScian.do?codeScian=' + codeScian;
}
}

function bidon() {}


So when I click on my item, I have the confirm popup who give me the choise of continuing or stopping, but the document.location line is not executed.

Only the javascript:void(0) is called. And I know it because I tried with a javascript:alert('yo') instead.

So what can I do to make my ajouterScian function call another page?
View User's Profile View All Posts By User U2U Member
kozman
Member

Posts: 15
Registered: 4/10/2003
Member Is Offline
posted on 12/2/2003 at 04:50 AM Reply With Quote
Calling another page


Your bidon() function has to return 'true' in order for this to work correctly.

function bidon()
{
return true;
}

As for calling up another page, using document.location will cause the current page with the tree to get redirected (unless your using frames in which case the DOM object 'document' will refer to the document in the frame where the javascript is executing). In my app, I am calling the MyFx() which, in turn, calls the submit() function on a form tag thus giving me more control which frame will get the redirect.
View User's Profile View All Posts By User U2U Member
epotvin
Junior Member

Posts: 6
Registered: 10/21/2003
Member Is Offline
posted on 12/3/2003 at 06:12 PM Reply With Quote

Ok, thanks! So now it's working! But my style-sheet are no longer functionnal. When I click on my item, my js function is called but the style for selected item is not applied.

I setted my style to make the selected item bold.

Manu
View User's Profile View All Posts By User U2U Member
kozman
Member

Posts: 15
Registered: 4/10/2003
Member Is Offline
posted on 12/3/2003 at 07:18 PM Reply With Quote
Selected Item


If I understand your dilemma correctly, your talking about the style that gets applied to a "a:active" element. If this is the case, the "a:active" will only ever show as long as the focus doesn't leave the hyperlink that you clicked on. This focus is across all frames within a current browser window. Once you either run javascript to change focus, or you interact with a page by clicking somewhere into the browser window, your focus will change and the "a:active" style will be removed.

The way I worked around this was that I changed the icon associated with the node text such that when the node was selected, the icon would change. This solution gives us enough visual indication that I didn't have to bother with writing javascript that will go back into the tree and maintain "state" so that we could temporarily overwrite the "unselected" stylesheet with the "selected" style sheet for the one node that was currently selected (this, of course, has its share of problem aside from the obvious issue of code maintanability)
View User's Profile View All Posts By User U2U Member
epotvin
Junior Member

Posts: 6
Registered: 10/21/2003
Member Is Offline
posted on 12/3/2003 at 07:31 PM Reply With Quote

I understand, but it's not resolving my problem. What I want to do is very simple, so I'll explain it from the beginning.

In my page, I have a tree and a link just above named "Select". This link call a javascript function who redirect the call to a server side program (a servlet), with a parameter named item_id.

The only behaviour I want from my tree is changing the value of a variable everytime I click on an item.

Each node of the tree has a link associated to it who looks like : javascript:changeCurrentItem(XXX)
where XXX is the current item Id.

So writing the javascript:.... as a link in the TREE_ITEMS array make the icons desapears. Bad idea.

Using the hs item scope setting works, but I need to put something for the link element.

If I put null or nothing, the browser try to call named null or undefined on the server, who respond with a 404 error.

If I put javascript:void(0), my icon problem come back.

So what should I do?
View User's Profile View All Posts By User U2U Member
kozman
Member

Posts: 15
Registered: 4/10/2003
Member Is Offline
posted on 12/4/2003 at 01:43 AM Reply With Quote
Stuck


Sounds like the efficiencies gained by calling javascript:void() in the anchor and using the hs:"MyFx(arg)+DummyFx" are not enough to keep you from experiencing the disappearing icons when the cache setting is turned off.

I truely think that the disappearing icon problem is directly related to the speed of icons getting to the screen (If you have 100 nodes to show...that is 100 icons + (100 * num of Levels deep for tree branch icons). That's a lot of images to suck over during each navigation click.

I can still see the disappearing icons when I have a connection that is slow enough (ie. If I try and contact my work website from my home machine over a VPN, I can actually lock up IE if I navigate too fast. My ping time from home is around 120ms). I'm currently having a dialog with SoftComplex about the IE lockup problem. I can tolerate the images not showing up "immediately" over slow connections...However, an IE lockup is a different story (You can see one of my other postings dealing with my rant on the lockup issue).

The moral of the story is that the javascript:void() approach will lower your risk of hitting the disappearing icon problem, but it doesn't eliminate it.

Hope this gives you some insight.
View User's Profile View All Posts By User U2U Member
epotvin
Junior Member

Posts: 6
Registered: 10/21/2003
Member Is Offline
posted on 12/4/2003 at 02:50 PM Reply With Quote

Thank you for the information. My tree have a total of 1500 nodes, so I think that it is the problem.

My apache instance is on my workstation and I have a centrino 1.5 ghz. So it's not a performance problem.

I'll try the automatic cache solution and if it's work, i'll add the instruction to do it on my web site
View User's Profile View All Posts By User U2U Member
epotvin
Junior Member

Posts: 6
Registered: 10/21/2003
Member Is Offline
posted on 12/4/2003 at 02:53 PM Reply With Quote

YES! My cache is already to automatic...
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