[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

multiple sort problem

Subject: multiple sort problem
From: Ravi Danda <ravidanda@xxxxxxxxx>
Date: Wed, 12 Jan 2005 18:11:05 -0800 (PST)
sort.gif
Sorry for the long mail..

I am having trouble sorting multiple tables on one
style sheet .I have three different tables with their
own Div ID on my style sheet. The sorting works well
on the first table,but for the second and third
tables,sorting doesn't work. Even worse,when clicked
on a column in the second and third table,the first
table gets sorted.

Below is the sort methods I have for the first and
second tables along with the init..

 function init()
		{
			stylesheet = document.all.tableXSL.XMLDocument;
			if (stylesheet == null) return;
			source = document.all.XMLdata.XMLDocument;
			sortOrder =
document.XSLDocument.selectSingleNode("//xsl:sort/@order");
			sortField =
stylesheet.selectSingleNode("//xsl:sort/@select");
			dataType =
document.XSLDocument.selectSingleNode("//xsl:sort/@data-type");
			sortOrder1 =
document.XSLDocument.selectSingleNode("//xsl:sort/@order");
			sortField1 =
stylesheet.selectSingleNode("//xsl:sort/@select");
			dataType1 =
document.XSLDocument.selectSingleNode("//xsl:sort/@data-type");
			lastSortField=sortField.value;
                       
lastSortField1=sortField1.value;
		        sortOrder.value = 'descending';
			sortOrder1.value = 'descending';
			sortList1('./FTI_TICKET_NO',8);
                        document.all["TD8"].className 
= 'tablehead';
			sortList('./FTI_TICKET_NO',1);
			document.all["TD1"].className  = 'tablehead';
			for(var i=1; i <= 21; i++)
			{
			 document.all["IMG"+i].src =
'../includes/images/sort.gif';
			}
		}
//for pending complete tickets

               function sortList1(field1,num)
		{

			if(field1==lastSortField1)
			{
		 		if(sortOrder1.value!='ascending')
		 			sortOrder1.value='ascending';
		 		else
		 		        sortOrder1.value='descending';
			}
			//alert(sortOrder1.value);
			sortField1.value =field1;
			lastSortField1=field1;
			  if( num==8 || num==9 || num==10 ||num ==11 || num
== 12 || num == 13 || num ==14 )
			    {
				dataType.value='number';
                            }
			  else
				dataType.value='text';
                      newHTML =
source.transformNode(stylesheet);
                      document.all.tableBody.innerHTML
= newHTML;
			//document.body.innerHTML = "";
		
//document.body.innerHTML=source.documentElement.transformNode(stylesheet);
			//change styles
			for(var i=8; i <= 14; i++)
			{
				document.all["TD"+i].className  = "tablehead";
			}

			document.all["TD"+num].className  = "tablelink";
			if(sortOrder1.value == 'ascending')
			  document.all["IMG"+num].src =
"../includes/images/sortup.gif";
			else
			  document.all["IMG"+num].src =
"../includes/images/sortdown.gif";
		     
if(document.getElementById("btnCollapseExpand").value
== 'Closed Tickets++')
		       {
                       
document.getElementById("btnCollapseExpand").value =
"Closed Tickets- -";
                       
document.getElementById("CLOSEDTICKETSDIV").style.display="inline";
                       }
      
		}
        //Implementing Sorting
		function sortList(field,num)
		{

			if(field==lastSortField)
			{
		 		if(sortOrder.value!='ascending')
		 			sortOrder.value='ascending';
		 		else
		 		        sortOrder.value='descending';
			}
			sortField.value =field;
			lastSortField=field;
			  if(num==1 || num==2 || num==3 ||num ==4 || num ==
5 || num == 6|| num ==7 || num==15 || num==16 ||
num==17 ||num ==18 || num == 19 || num == 20 || num
==21)
			    {
				dataType.value='number';
                            }
			  else
				dataType.value='text';

			document.body.innerHTML = "";
		
document.body.innerHTML=source.documentElement.transformNode(stylesheet);
			//change styles
			for(var i=1; i <= 7; i++)
			{
				document.all["TD"+i].className  = "tablehead";
			}

			document.all["TD"+num].className  = "tablelink";
			if(sortOrder.value == 'ascending')
			  document.all["IMG"+num].src =
"../includes/images/sortup.gif";
			else
			  document.all["IMG"+num].src =
"../includes/images/sortdown.gif";

  
                      
if(document.getElementById("btnCollapseExpand").value
== 'Closed Tickets++')
		       {
                       
document.getElementById("btnCollapseExpand").value =
"Closed Tickets- -";
                       
document.getElementById("CLOSEDTICKETSDIV").style.display="inline";
                       }
		}

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.