Hi,
Yes you were right, it seems "this" wasn't referencing the form, if you
simply replace it with
line 149 onClick=javascript:FindNets(search.node.value)
and line 61 chk =
ar[i].desc.toLowerCase().indexOf(obj.toLowerCase())
then it's fine, see:
http://www.resass.f2s.com/dynapi2/dynapi/Ed_Baxter_Examples/tree.htm
as the example is not on the main site yet because the dynAPI version is
older.
regarding my changes:
No changes where made to the widget.
Basically I think you would want to adapt the widget a little, as your needs
are pretty specific, what I tried was writing the whole node content in a
table, and adding that to 1 node.
Cheers,
Richard Bennett
[EMAIL PROTECTED]
www.richardinfo.com
(Everything running on, and ported to the 19/12/2000 snapshot of DynAPI2)
----- Original Message -----
From: "Ed Baxter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 09, 2001 2:34 AM
Subject: Re: [Dynapi-Help] trouble with dynamic rebuild of Ri Fast Tree
widget
> Well I narrowed the problem down to a single line but can not figure out
WHY
> this causes problems with the widget. Here is what I found...please
reference
> my original posting for the full HTML code.
>
> In the FindNets function there is a line that compares the FORM input and
the
> "ar[i].desc" string for any matches:
> chk =
ar[i].desc.toLowerCase().indexOf(obj.form[2].value.toLowerCase())
> This appears to work as intended because it finds the desired array
values. If
> I replace the FORM value with a hard coded string, i.e.
> chk = ar[i].desc.toLowerCase().indexOf("par")
> Then the new tree widget is built correctly and operates without errors. I
> have tried many different combinations in trying to get the comparison
> accomplished but all result in the tree widget returning the javascript
error
> described in my original posting. I have tried stuff like:
>
chk=eval("ar[i].desc.toLowerCase().indexOf('"+obj.form[2].value.toLowerCase(
)+"')")
> and
> tmp = ar[i].desc.toLowerCase()
> sub = obj.form[2].value.toLowerCase()
> chk = tmp.indexOf(sub)
> and
> chk = tmp.indexOf(sub.toString())
> but found that anytime the FORM value is passed to the indexOf() function,
it
> breaks the widget.
>
> Perhaps someone who has a more in depth understanding of Javascript can
tell me
> what the connection is. I sure can't see it!
>
> TIA
> Ed Baxter
>
> ----- Original Message -----
> Hi,
> I put your example up here:
>
http://www.resass.f2s.com/dynapi2/dynapi/Ed_Baxter_Examples/tree.htm
> I changed the source a little,(Only for the All_Nets for the
moment) NS
> still needs some adjustment to recognize CSS for titles though.
> I didn't find the reason for NS crashing after a search, all I
found I found
> was that NS passes a string instead of an object as parameter
(anets).
> (there's an alert to check for this value now) I don't think this
is
> tree-specific, as the All_Nets and All_Nodes work ok, it must be
something
> to do with the value of "anets" which the search passes to
NewTree().
> Also, It might be better to keep "all nodes", and "all nets" as
two trees
> (show/hide) to avoid writing *to* many layers, because browser
memory is not
> freed by deleting the tree.
> Although it works nicely (apart from NS search), if you have
memory problems
> another approach would be to show/hide the nodes you need, or
dynamically
> add them to an existing tree (although I'm not quite sure how you
could do
> that).
>
> Cheers,
> Richard Bennett
>
> [EMAIL PROTECTED]
> www.richardinfo.com
> (Everything running on, and ported to the 19/12/2000 snapshot of
DynAPI2)
> ----- Original Message -----
> From: "Ed Baxter" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 07, 2001 2:26 AM
> Subject: Re: [Dynapi-Help] trouble with dynamic rebuild of Ri Fast
Tree
> widget
>
>
> > I forgot to mention in the original post that I am using Dynapi2
release
> > 1/25/2001
> >
> > On Tue, 06 Feb 2001, Ed Baxter wrote:
> > >I'm hoping someone can help me with my implementation of
Richard
> Bennett's Fast
> > >Tree Widget. I have included a copy of my code.
> > >
> > >Basically I am building the Tree dynamically from an array so
that I can
> alter
> > >the data, then pass the new array to a function that builds a
new tree
> with the
> > >new values. The page has a search function that builds the new
tree using
> only
> > >array values that match the search criteria. The search results
are the
> part
> > >that has been giving me trouble for several days now. The tree
gives a
> > >javascript error when an expand is attempted with Netscape
(linux/4.72
> and
> > >NT4.0/4.76). IE5.5 works fine but has other problems (tree
nodes are
> blank).
> > >
> > > JavaScript Error:
> > > http://[path to dynapi]/src/lib/dynapi/ri/fasttreenode.js,
line 188:
> > > this.doc.images[this.id + "sw"] has no properties.
> > >
> > >To get the error, type "par" (no quotes) in the first search
box and
> press go,
> > >then try to expand the new tree that is drawn.
> > >
> > >This does not happen when I delete the tree and rebuild using
all of the
> > >original data (All Nets button). I once added a pop-up and
confirmed that
> > >this.doc.images.length=1 but I am unable to access any
properties and so
> > >get the error. Funny thing is, the image IS displayed so it
should have
> some
> > >properties! If I comment out line 188 referred to by the error
then
> things
> > >work.
> > >
> > >Can anyone tell me what I'm missing? Is there a work around? Am
I doing
> > >something wrong?
> > >
> > >TIA,
> > >Ed Baxter
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
> ____________________________________________________________
> Get your free domain name and domain-based e-mail from
> Namezero.com. New! Namezero Plus domains now available.
> Find out more at: http://www.namezero.com
>
Title: Ri Fast Tree Example