xsl-list
[Top] [All Lists]

Multiple tables in one sheet -- sort problem

2005-01-13 14:39:35


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 


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





                
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>