Script: DD Contractible Headers Script
http://www.dynamicdrive.com/dynamicindex1/navigate2.htm
Hi
I have a progam that uses a vb dll to extract data from a storedproc in a sql db. I am using the above script to display the data like a tree view on my asp page. I have modified nothing on the javsc. enablepersist is 'on' and collapseprevious is 'yes'
My poblem is that when I open the page and click on the link to expand it, I only see the first record in the recordset.
E.g The page looks like this:
Fruits
Raw Materials
Vegetables
When I click on Fruits I should get this view:
What I couldn't figure it out for a long time then I thought to include a counter for the class so my code ended up looking like this: Note the lines in line that I adjusted to accomodate the loop.Code:Fruits Canned Dried Fresh Raw Materials Vegetables Instead I get: Fruits Canned Raw Materials Vegetables
1. After this modification, when I open the page, the whole list is expanded before the user even clicks on any of them like this:Code:... dim deptmOBJ dim deptmRS dim simDept dim simGroup dim simProdline dim counter dim counter2 counter = 0 counter2 = 0 simDept = "" simGroup = "" simProdline = "" set deptmOBJ = Server.CreateObject("ContredWebDLL.clsProduct") set deptmRS = deptmOBJ.GetDepartment if deptmOBJ.ErrorNum <> 0 then Response.Redirect "../errorpage.asp?errno=" & deptmOBJ.ErrorNum & "&errdesc=" & deptmOBJ.ErrorDesc end if if not deptmRS.eof then do while not deptmRS.eof 'Statement below eliminates repeats of department if simDept = "" OR simDept <> trim(deptmRS.fields("department")) then %> <tr> <dl id = "deptgroup"> <dt> <span onClick="expandcontent('sc1<%=counter%>')" style="cursor:hand; cursor:pointer" title="Click here to view the groups of this department"> <font face="Tahoma" color="#FFFFFF" size="3"><b><%=deptmRS.Fields("dept_descr")%></b></font> </span> <td> </td> <a href="product.asp?UserID=<%=request("UserID")%>&BranchID=<%=request("BranchID")%>&selDept=<%=trim(deptmRS.fields("department"))%>&Submitted=Y&pageno=1" style="text-decoration:none"> <img src="images/submit.jpg" width="20" height="15" value="Y" alt="Click here to expand the view"> </a> </dt> </dl> </tr> <% end if '********************************************************************************************************************* if simGroup = "" OR simGroup <> trim(deptmRS.fields("group_no")) then %> <tr> <div id="sc1<%=counter%>" class="switchcontent<%=counter%>"> <dl id="groupprod"> <dt> <dd> <span onClick="expandcontent('sc2<%=counter2%>')" style="cursor:hand; cursor:pointer" title="Click here to view the Product lines of this Group"> <font face="Tahoma" color="#FFFFFF" size="2"><b><%=deptmRS.Fields("group_descr")%></b></font> </span> <td> </td> <a href="product.asp?UserID=<%=request("UserID")%>&BranchID=<%=request("BranchID")%>&selDept=<%=trim(deptmRS.fields("department"))%>&selGroup=<%=trim(deptmRS.fields("group_no"))%>&Submitted=Y&pageno=1" style="text-decoration:none"> <img src="images/submit.jpg" width="20" height="15" value="Y" alt="Click here to expand the view"> </a> </dd> </dt> </div> </dl> </tr> <% end if '********************************************************************************************************************* %> <tr> <div id="sc2<%=counter2%>" class="switchcontent<%=counter%>"> <dd> <dd> <dd> <span style="cursor:hand; cursor:pointer" title="Click to view the Products for this line"> <font SIZE="1.8" FACE="Tahoma" COLOR="#FFFFFF"><b><%=deptmRS.Fields("product_descr")%></b></font> </span> <td> </td> <a href="product.asp?UserID=<%=request("UserID")%>&BranchID=<%=request("BranchID")%>&selDept=<%=trim(deptmRS.fields("department"))%>&selGroup=<%=trim(deptmRS.fields("group_no"))%>&selProdLine=<%=trim(deptmRS.fields("product_line"))%>&Submitted=Y&pageno=1" style="text-decoration:none; cursor:hand; cursor:pointer" title="Click to view the Products for this line"> <img src="images/submit.jpg" width="20" height="15" value="Y" alt="Click here to expand the view"> </a> </dd> </dd> </dd> </dl> </div> </tr> <% '********************************************************************************************************************* simDept = trim(deptmRS.fields("department")) simGroup = trim(deptmRS.fields("group_no")) simProdline = trim(deptmRS.fields("product_line")) counter = counter + 1 counter2 = counter2 + 1 deptmRS.MoveNext loop end if deptmRS.Close set deptmRS = nothing %>...
2. When I click on Fruits (I have to click twice), only Canned is hidden, Dried and Fresh are not hidden. When I click on Canned (I have to click twice as well here), it only hides Puree and leaves out Solid.Code:Fruits Canned Puree Solid Dried Powder Fresh Raw Cooked Raw Materials Bathroom Taps Baths Kitchen Sinks Vegetables...and so forth
3. I also tried opening the page and only clicking on Fruit and it only hide Canned, but left out Puree and Solid. I tried contracting the list as far as it would allow me and went to another page, when I came back, the list had been expanded again.
I do realize though that my problem lays in the section in red, but I can't figure out what to do about it.
Kindly please help me
Thanks
Kind Regards



Reply With Quote
Bookmarks