I used this to remove rows that were not Object Category strings. you can easily change this to hide or simply change the style of these lines if that is what you need. In addition, you can easily change this to read in a table from a source other than the page itself. Demo
var mytable = [];
var rows = $('table').find('tr');
for(var i = 0; i < rows.length; i++) {
if(rows.eq(i).find('td[colnum="c2"]').text() == "Asset Category") {
mytable.push(rows.eq(i));
}
}
$('table').html("");
for(var j = 0; j < mytable.length; j ++) {
$('table').append(mytable[j]);
}
In addition, you can read table data from another file (for example, an XML file). This version of the layout imports the table and evaluates it, starting with the data line of the table. Alternative DEMO
var tablestring = '<table><tr linetype="data" linenum="1"><td colnum="c0">Balanced</td> <td colnum="c1" rawvalue="24">24</td><td colnum="c2">Allocation</td></tr>...</table>';
var xmlDoc = $.parseXML( tablestring );
var $xml = $( xmlDoc );
var mytable = [];
var rows = $xml.find('tr');
for(var i = 0; i < rows.length; i++) {
if(rows.eq(i).find('td[colnum="c2"]').text() == "Asset Category") {
var temprow = document.createElement("TR");
temprow.innerHTML = rows.eq(i).html();
mytable.push(temprow);
}
}
var newtable = document.createElement("TABLE");
$newtable = $( newtable );
for(var j = 0; j < mytable.length; j ++) {
$newtable.append(mytable[j]);
}
$('body').append($newtable);
Julle source
share