Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: Disabling change of doc image

sstree
Discussion topic

Back to topic list

Re: Disabling change of doc image

Reply

Author anoncvs
Full name anonymous CVS access
Date 2003-07-21 12:51:54 PDT
Message Hey Peter,

I have subscribed you to the dev@sstree mailing list so that you will
get this reply. The list has very low traffic at the moment.

>I'm trying to apply the sstree stuff to the module list in Scarab. One =
>thing I have noticed is that if you click on
>the image associated with a leaf ie. of class =3D "doc" it changes the =
>image to folder-closed. when it should
>remain unchanged.
>
>I'm not very familiar with javascript -- I tried testing the class of =
>the elm or row but it doesn't seem to
>work.

I'm glad to see you are trying sstree for scarab. I also hope that
people will find it to be a useful starting point for other projects
too.

I think you need an HTML change rather than a javascript change. The
class="folder" <a> tags should have onclick="toggle(this)". The
class='doc" should not have any onclick attribute. That way, nothing
happens when a user clicks on a "doc", it will just keep the same
background image. Here is a fragment from
http://sstree.tigris​.org/nonav/example2.​html that illustrates it:



<li><a id="impl" href="#default.impl" class="folder" onclick="toggle(this​)"></a>Impl​ementation and Testing
     <ol>

      <li><a href="#" class="doc"></a><a href="#">Implementation documentation</a​></li>
      <li><a href="#" class="doc"></a><a href="#">User guide</a></li>
      <li><a href="#" class="doc"></a><a href="#">Test suite</a>
       <ul>
        <li><a href="#">Test case format</a></li>
        <li><a href="#">Test cases</a></li>
       </ul>
      </li>
     </ol>
    </li>


Note that in this example, for the 4th level I just used a <ul>
without any icons. The <ul> makes it stay open always, only <ol>
lists expand and collapse in my examples. The reason for that is
that, for my examples, I think it made sense to show the 4th level of
detail (sections within a document) as bullets whenever the user
expresses interest in a particular 2nd level item. If that does not
make sense in your application, you can just use <ol> for everything,
or you can change the CSS rules and add a onclick to any node that you
want to expand, but it should appear as a folder, not a document .

If you do find that you need to learn more javascript. I recommend
http://www.amazon.co​m/exec/obidos/ASIN/0​596000480/tigris-20
And some other books on CSS, etc are at http://jrobbins.org/books/

I think you should be able to use if (elm.class == 'folder').
However, the current code also looks for elm's next sibling to be an
<ol>. If it is a <ul>, then elm's image will be stuck as
closed-folder. So, that might explain why it looked like you could
not check the class, depending on exactly how you did the HTML.

Thanks,
jason!

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: dev-unsubscribe@sstr​ee.tigris.org
For additional commands, e-mail: dev-help at sstree dot tigris dot org

« Previous message in topic | 2 of 2 | Next message in topic »

Messages

Show all messages in topic

Disabling change of doc image "EXT-McTaggart, Peter" <peter dot mctaggart at boeing dot com> "EXT-McTaggart, Peter" <peter dot mctaggart at boeing dot com> 2003-07-20 22:09:02 PDT
     Re: Disabling change of doc image anoncvs anonymous CVS access 2003-07-21 12:51:54 PDT
Messages per page: