Autor Beitrag
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 08.07.08 12:40 
Oder so:

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">

function setDataType(cValue)
  {
    //Konvertiert die Inhalte der Zellen, damit richtig sortiert werden kann
    var isDate = new Date(cValue);
    if (isDate == "NaN")
      {
        if (isNaN(cValue))
          {
            //Zeichenkette ist ein String -> alles in Großbuchstaben
            cValue = cValue.toUpperCase();
            return cValue;
          }
        else
          {
            //Zeichenkette ist numerisch
            var myNum;
            myNum = String.fromCharCode(48 + cValue.length) + cValue;
            return myNum;
          }
        }
  else
      {
        //Datum
        var myDate = new String();
        myDate = isDate.getFullYear() + " " ;
        myDate = myDate + isDate.getMonth() + " ";
        myDate = myDate + isDate.getDate(); + " ";
        myDate = myDate + isDate.getHours(); + " ";
        myDate = myDate + isDate.getMinutes(); + " ";
        myDate = myDate + isDate.getSeconds();
        return myDate ;
      }
  }
function sortTable(col, tableToSort)
  {
    var iCurCell = col + tableToSort.cols;
    var totalRows = tableToSort.rows.length;
    var bSort = 0;
    var colArray = new Array();
    var oldIndex = new Array();
    var indexArray = new Array();
    var bArray = new Array();
    var newRow;
    var newCell;
    var i;
    var c;
    var j;
    // Aktuelle Daten der Tabelle in Array überführen
    for (i=1; i < tableToSort.rows.length; i++)
      {
        colArray[i - 1] = setDataType(tableToSort.cells(iCurCell).innerText);
        iCurCell = iCurCell + tableToSort.cols;
      }
    // Arrayelemente kopieren
    for (i=0; i < colArray.length; i++)
      {
        bArray[i] = colArray[i];
      }
    //Die Items sortieren
    colArray.sort();
    for (i=0; i < colArray.length; i++)
      { //Schleife für neusortiertes Array
        indexArray[i] = (i+1);
        for(j=0; j < bArray.length; j++)
          { //Altes Array durchgehen
            if (colArray[i] == bArray[j])
              {  ///Sortierung
                for (c=0; c<i; c++)
                  {
                    if ( oldIndex[c] == (j+1) )
                    {
                      bSort = 1;
                    }
                      }
                      if (bSort == 0)
                        {
                          oldIndex[i] = (j+1);
                        }
                          bSort = 0;
                        }
          }
    }
  //Sortierung fertig
  for (i=0; i<oldIndex.length; i++)
    {
      newRow = tableToSort.insertRow();
      for (c=0; c<tableToSort.cols; c++)
        {
          newCell = newRow.insertCell();
          newCell.innerHTML = tableToSort.rows(oldIndex[i]).cells(c).innerHTML;
        }
      }
  //Neue Zeilen an den Tabellenanfang setzen
  for (i=1; i<totalRows; i++)
    {
      tableToSort.moveRow((tableToSort.rows.length -1),1);
    }
  //Alten Zeilen am Ende löschen
  for (i=1; i<totalRows; i++)
    {
      tableToSort.deleteRow();
    }
  }

</script>

</HEAD>

<BODY>

<TABLE WIDTH="49%" BORDER=1 CELLSPACING=1 CELLPADDING=1 name="rsTable" id=rsTable  cols=5>
  <TR bgcolor=#CCCCCC> 
    <TD width="8%"><A href="javascript:sortTable(0, rsTable);"><FONT color=white><B>ID</FONT></B></A></TD>
    <TD width="12%"><A href="javascript:sortTable(1, rsTable);"><FONT color=white><B>Name</FONT></B></A></TD>
    <TD width="17%"><A href="javascript:sortTable(2, rsTable);"><FONT color=white><B>Geburtstag</FONT></B></A></TD>
    <TD width="15%"><A href="javascript:sortTable(3, rsTable);"><FONT color=white><B>Telefon</FONT></B></A></TD>
    <TD width="48%"><A href="javascript:sortTable(4, rsTable);"><FONT color=white><B>Zimmernummer</FONT></B></A></TD>
  </TR></FONT>
  <TR> 
    <TD>1</TD>
    <TD>Müller</TD>
    <TD>01.02.1903</TD>
    <TD>123-456-789</TD>
    <TD>112</TD>
  </TR>
  <TR> 
    <TD>2</TD>
    <TD>Vogel</TD>
    <TD>04.05.1906</TD>
    <TD>987-654-321</TD>
    <TD>911</TD>
  </TR>
  <TR> 
    <TD>3</TD>
    <TD>Adam</TD>
    <TD>07.08.1909</TD>
    <TD>123-987-456</TD>
    <TD>999</TD>
  </TR>
</TABLE>
</BODY>
</HTML>

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Di 08.07.08 13:03 
Hab jetzt aber ein ganz anderes Problem:
Das Script soll zum soriteren eines Telefonbuchs dienen...

Wenn dieses Telefonbuch aber 1140 Einträge hat, dann wirds lustig:

Lass mal ein Javascript 494.497.990 Vergleiche und bis zu 6.922.971.860 Tabellenzellen-Austausche durchführen...

_________________
1405006117752879898543142606244511569936384000000000.
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 08.07.08 13:09 
so..jez meine frage..woher kommen die Daten?

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Di 08.07.08 13:17 
Die kommen schon vorher ausm Active Directory, über ASP.Net...

_________________
1405006117752879898543142606244511569936384000000000.
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 08.07.08 13:21 
Dann sortier mit ASP.NET..ganz einfach..

Kannst ja über ASP das aufrufen und die Daten so sortieren lassen, wie du willst.

Auf jedenfall ist Javascript dafür echt ungeeignet..

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Di 08.07.08 13:22 
ok...
ich werd mal schauen, was ich da machen kann...

_________________
1405006117752879898543142606244511569936384000000000.
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Di 08.07.08 13:33 
bumm... wie kann ich GET-Parameter mit ASP.Net auslesen??

_________________
1405006117752879898543142606244511569936384000000000.
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 08.07.08 13:39 
Neue Frage -> Neuer Thread..

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Di 08.07.08 13:42 
jaja... schon gut...


war das nicht "neue frage, ab inne SB"?

_________________
1405006117752879898543142606244511569936384000000000.