I have an external file (colors.html) that contains lines of data that look like this:
<tr><td>Forten Aramid Composite 18</td><td>40</td><td>Natural</td><td>660</td><td>Natural</td><td></td></tr>
<tr><td>Forten Aramid Gear 16L</td><td>40</td><td>Natural</td><td>660</td><td>Natural</td><td></td></tr>
In my calling HTML document, I have given the <tbody> tag the ID of "color-data", so that I can populate the table body using this code:
$(document).ready(function () {
$('#color-data').load('colors.html');
});
However, Datatables doesn't pick up the fact that I've populated the table, so there is no formatting, sorting, filtering, etc. (When I hard-code the data into the calling file, everything works perfectly.)
I've tried using the jQuery .load() callback feature, and the DataTables fnInitComplete feature, but I must be doing something incorrectly because even when the data loads from the external file, DataTables doesn't recognize and process it. It also works great when the external file is in JSON format, and I call it using sAjaxSource, but unfortunately the external file is in HTML and not JSON format.
Is it possible to make this combination work?
<tr><td>Forten Aramid Composite 18</td><td>40</td><td>Natural</td><td>660</td><td>Natural</td><td></td></tr>
<tr><td>Forten Aramid Gear 16L</td><td>40</td><td>Natural</td><td>660</td><td>Natural</td><td></td></tr>
In my calling HTML document, I have given the <tbody> tag the ID of "color-data", so that I can populate the table body using this code:
$(document).ready(function () {
$('#color-data').load('colors.html');
});
However, Datatables doesn't pick up the fact that I've populated the table, so there is no formatting, sorting, filtering, etc. (When I hard-code the data into the calling file, everything works perfectly.)
I've tried using the jQuery .load() callback feature, and the DataTables fnInitComplete feature, but I must be doing something incorrectly because even when the data loads from the external file, DataTables doesn't recognize and process it. It also works great when the external file is in JSON format, and I call it using sAjaxSource, but unfortunately the external file is in HTML and not JSON format.
Is it possible to make this combination work?