Your input is appreciated!

Results 1 to 3 of 3

Thread: Your input is appreciated!

  1. #1
    Join Date
    Dec 1969

    Default Your input is appreciated!

    Hey all,<BR>I am developing a web app that hits an Oracle DB and then populates an HTML table with that info. Not a problem. However, I need be able to sort the data in the table when a user clicks on the column heading. Kinda a problem. I have the sorting alogrithm working(Quicksort), but how do I implement it? For example, when a user clicks on a column heading, can I submit the script back to itself, and redisplay the page? Or, do I call another remote script and then somehow get back to the original page with the data sorted? Any ideas/comments/solutions/suggestions would be appreciated.<BR><BR>Thanks in advance,<BR><BR>JOHN

  2. #2
    SPG Guest

    Default RE: Your input is appreciated!

    I would point the script back at itself, as mentioned -- although not completely efficient, it&#039s really good for portability. Use something like<BR><BR>linkBack = request.serverVariables("URL")<BR><BR>and then just point to linkBack whenever you need it, such as<BR><BR>&#060;form action="&#060;%= linkBack %&#062;?action=upload" method="post" enctype="multipart/form-data"&#062;<BR><BR>which allows you to test for the queryString("action") and, if it&#039s "upload" handle the file upload, right in your script! Additionally, you could add something like<BR><BR>&#060;form action="&#060;%= linkBack %&#062;?action=search" method="post"&#062;<BR><BR>and add another condition where a search is performed instead of an upload! (As stated, it&#039s not the best for loading speed, but it&#039s *so* much more portable...)

  3. #3
    Join Date
    Dec 1969

    Default RE: Your input is appreciated!

    I&#039m not quite sure what SPG was getting at, but here&#039s what I do.<BR><BR>Make the column heading link back to the same page, but add a querystring value that is the name of the field it corresponds to in the database. E.g. &#060;a href="mypage.asp?field=name"&#062;Name&#060;/a&#062;.<BR><BR>Now, just rerun your query with the new field to sort by<BR><BR>&#060;%<BR>&nbsp;&nbsp;&nbsp;&nbsp;strSo rtBy = Request.QueryString("field")<BR><BR>&nbsp;&nbsp;&n bsp;&nbsp;if strSortBy = "" then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;strSortBy = &#060;default sort field&#062;<BR>&nbsp;&nbsp;&nbsp;&nbsp;end if<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;strSQL = "SELECT * FROM tblMyTable ORDER BY " & strSortBy<BR>%&#062;<BR><BR>You&#039ll need to have that if statement in there for the case when this is the first time the page is called. This way you can just make use of the sort algorithms in the database engine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts