0

I have an HTA which loads in a large table into HTML. However, I want to take advantage of the jquery plugin for Datatables. However, when i got to run my script it gets an script error at line : <script language="javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script> which makes me think I am not implementing jquery correctly. From all the post I have seen javascript files seem to be loaded in this way even for HTAs. It also takes quite a bit to load the 15000 rows so once Datatables is implemented and there is pagination then shouldnt the load time be reduced?

<!DOCTYPE html>
<html lang="en-US">
<style>
</style>
<head>
<title>ARMS Hamburger Site</title>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="ie=9">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script language="javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script language="javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
</head>
<body>
<script language="javascript">
var today = new Date();
var t0 =  today.getSeconds();
var connection = new ActiveXObject("ADODB.Connection") ;
var rs = new ActiveXObject("ADODB.Recordset");
var connectionstring="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\\\path.accdb;Jet OLEDB:Engine Type=5;Persist Security Info=False;Mode=Share Exclusive;"

connection.CursorLocation=3;
connection.Mode=3;
connection.Open(connectionstring);

rs.Open("SELECT * FROM table", connection);

var str=rs.GetString(2,rs.RecordCount,"</td><td>","</td></tr><tr><td>"," ");

rs.close;
connection.close; 
</script>
<center>
<table id="myTable" class="display" style="width:100%">
<tr>
<td><script language="javascript">document.write(str)</script></td>
</tr>
</table>
</center>
</body>
</html>
<script language="javascript">
    $(document).ready(function() {
        $('#myTable').DataTable();
} );
</script>
Teemu
  • 21,017
  • 6
  • 49
  • 91
Irish Redneck
  • 161
  • 13
  • Maybe you should use a newer IE version? Notice, that jQuery 3.X doesn't support IE<9 (you're running the HTA in IE7 standards mode). See https://stackoverflow.com/questions/19567887/javascript-version-in-hta . See also https://jquery.com/browser-support/ – Teemu Apr 25 '19 at 19:31
  • So i set it to the newest version similar to indicated in that post: which should work since we have internet explorer 11 but i still draw an error for that jquery link. – Irish Redneck Apr 25 '19 at 19:37
  • What is the error message? It could be also a cross-domain issue, I'd make a local copy of the jQuery library, and loaded it instead of the online library. – Teemu Apr 25 '19 at 19:39
  • The error I get is Script error , Code 0, URL: https://code.jquery.com/jquery-3.3.1.js . I will give it a try and do the local copy. – Irish Redneck Apr 25 '19 at 20:24
  • Hey so i loaded it locally and it now tells me the exact error. Unable to set property '_DT_Cellindex' of undefined or null reference, and the url now points to the path I saved it at but still that jquery file . I am not sure what this means but its progress! – Irish Redneck Apr 25 '19 at 20:43
  • From googling it looks like there might be something wrong with my table? – Irish Redneck Apr 25 '19 at 20:45
  • So the end of my str string ends with so if you look at my html then that means I started another row with just one column. Any idea how I can account for this so it just doesnt create a new row like getstring tries to make it? – Irish Redneck Apr 25 '19 at 21:11
  • I don't think you can have that last ` – Rich Moss Apr 26 '19 at 17:55
  • 1. Don't try and use Edge because your vbscript will no longer work. Also, I noticed recently that vbscript is really slow at generating the html string so I don't think it's the data tables JavaScript that is slow. I now pass data to a JavaScript function that is much quicker at rendering the HTML using append. I may post a demo if you're interested. – Gordon May 16 '19 at 21:35

0 Answers0