Support Forums

[HTA] Sorting Table

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.
User avatar
hackoo
Posts: 103
Joined: Sat Jan 22, 2011 12:27 am

[HTA] Sorting Table

Postby hackoo » Mon Nov 25, 2013 10:16 pm

Hello,
I have a JS that allows you to sort the columns in my table (ASC, DESC).
http://www.kryogenix.org/code/browser/s ... rttable.js
It works if I do the classic html, I can sort my columns generated statically.

VBScript Code
Double-click the code block to select all.
<html>
<script type="text/javascript" src="sorttable.js"></script>
<table class = 'sortable'><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td> </tr><tr><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr></table>
<body>
<span id = "oDivDisplayArea"></span></br>
</body>
</html>

However, if now I want to sort my table generated in vbs it no longer My table is displayed but becomes static, I can not use the arrows that allow you to sort my columns works.
If you have an idea, I'm interested.

VBScript Code
Double-click the code block to select all.
<html>
<script type="text/javascript" src="sorttable.js"></script>
<script language="VBScript">
Sub window_Onload
oDivDisplayArea.innerHTML = "<table class = 'sortable'><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td> </tr><tr><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr></table>"
End sub
</script>
<body>
<span id = "oDivDisplayArea"></span></br>
</body>
</html>


Thank you in advance !
User avatar
jvierra
Posts: 9699
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: [HTA] Sorting Table

Postby jvierra » Mon Nov 25, 2013 10:48 pm

You have to build the table as an object using createElement.

Sometimes a page refresh will work. Depends on the browser version.
User avatar
jvierra
Posts: 9699
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: [HTA] Sorting Table

Postby jvierra » Tue Nov 26, 2013 8:02 am

Try this version in an attached file.
Attachments
SortHighlightSnippet.zip
Unzip into folder and run Employees.hta
(126.86 KiB) Downloaded 423 times
User avatar
hackoo
Posts: 103
Joined: Sat Jan 22, 2011 12:27 am

Re: [HTA] Sorting Table

Postby hackoo » Sat Dec 07, 2013 7:39 am

Thank you for sharing this helpful code ;)

Return to “VBScript”

Who is online

Users browsing this forum: No registered users and 3 guests