datatable: update examples, remove compat.js - jscancer - Javascript crap (relatively small)
(HTM) git clone git://git.codemadness.org/jscancer
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 8cfbc8714f9cade06d8bd0bc50e9d26c332a1370
(DIR) parent b7fd47408230b99f76a479f88c2dabf9f6b4648e
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 2 Jun 2016 18:59:20 +0200
datatable: update examples, remove compat.js
Diffstat:
M datatable/example-ajax.html | 21 +++++++--------------
M datatable/example.html | 17 ++++++++++++++---
2 files changed, 21 insertions(+), 17 deletions(-)
---
(DIR) diff --git a/datatable/example-ajax.html b/datatable/example-ajax.html
@@ -3,22 +3,14 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jsdatatable AJAX</title>
- <link rel="stylesheet" type="text/css" href="style.css" />
- <style type="text/css">
- table {
- table-layout: fixed;
- width: 800px;
- }
- table.datatable tr td input {
- width: 100%;
- }
- </style>
+ <link rel="stylesheet" type="text/css" href="datatable.css" />
</head>
<body>
<input type="search" class="filter-text" value="" placeholder="Search..." autofocus="autofocus" /><br/>
-<table class="datatable">
+<!--<table id="datatable" class="datatable" style="display: none" data-lazyscroll="1" cellpadding="0" cellspacing="0" border="0">-->
+<table id="datatable" class="datatable" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th data-parse="int">#</th>
@@ -34,8 +26,7 @@
</tbody>
</table>
-<!--[if lte IE 8]><script type="text/javascript" src="../compat.js"></script><![endif]-->
-<script type="text/javascript" src="tbl.js"></script>
+<script type="text/javascript" src="datatable.js"></script>
<script type="text/javascript">
function datatable_load_data(d, data) {
@@ -72,6 +63,7 @@ function datatable_load_data(d, data) {
}
var ds = datatable_autoload();
+
var x = new(XMLHttpRequest);
x.onreadystatechange = function () {
if (x.readyState != 4 || [ 0, 200 ].indexOf(x.status) == -1)
@@ -82,7 +74,8 @@ x.onreadystatechange = function () {
} catch(e) {
return;
}
- datatable_display(ds[0], datatable_load_data(ds[0], rdata.data));
+ var d = ds[0];
+ d.display(datatable_load_data(d, rdata.data));
};
x.open("GET", "example-ajax-data.json?t=" + String((new(Date)).getTime()), true);
(DIR) diff --git a/datatable/example.html b/datatable/example.html
@@ -9,14 +9,15 @@
<input type="search" class="filter-text" value="" placeholder="Search..." autofocus="autofocus" /><br/>
-<table class="datatable" data-lazyscroll="1" cellpadding="0" cellspacing="0" border="0">
+<!--<table id="datatable" class="datatable" style="display: none" data-lazyscroll="1" cellpadding="0" cellspacing="0" border="0">-->
+<table id="datatable" class="datatable" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th data-parse="int">#</th>
<th data-parse="int" data-sortable="false" class="sort-disabled">Disabled sort</th>
<th data-parse="float"></th>
<th data-parse="float">€</th>
- <th data-filterable="false" data-parse="int">numbers (disabled filter)</th>
+ <th data-filterable="false" data-parse="int">numbers<br/>(disabled filter)</th>
<th>Description</th>
<th data-parse="int">yyyy-mm-dd</th>
</tr>
@@ -60,7 +61,17 @@
</tbody>
</table>
-<!--[if lte IE 8]><script type="text/javascript" src="../compat.js"></script><![endif]-->
+<noscript>
+<style type="text/css">
+#datatable {
+ display: table !important;
+}
+.filter-text {
+ display: none;
+}
+</style>
+</noscript>
+
<script type="text/javascript" src="datatable.js"></script>
<script type="text/javascript">var datatables = datatable_autoload();</script>