Complete merge & cleanup #434

This commit is contained in:
Mottie 2013-11-26 13:40:59 -06:00
parent f40e009347
commit 79bc1be5a5
3 changed files with 7 additions and 10 deletions

View File

@ -278,12 +278,8 @@
for ( i = 0; i < l; i++ ) { for ( i = 0; i < l; i++ ) {
tds += '<tr>'; tds += '<tr>';
for ( j = 0; j < d[i].length; j++ ) { for ( j = 0; j < d[i].length; j++ ) {
// build tbody cells // build tbody cells; watch for data containing HTML markup - see #434
var temp = $("<td>").html(d[i][j]); tds += /^\s*\<td/.test(d[i][j]) ? $.trim(d[i][j]) : '<td>' + d[i][j] + '</td>';
var inner = temp.find("td");
temp = inner.length ? inner : temp.wrap("<div>").parent();
tds += temp.wrap("<div>").parent().html();
} }
tds += '</tr>'; tds += '</tr>';
} }

View File

@ -2734,7 +2734,7 @@ $.extend($.tablesorter.themes.jui, {
<td>Function</td> <td>Function</td>
<td>null</td> <td>null</td>
<td> <td>
This function is required to return the ajax data obtained from your server into a useable format for tablesorter to apply to the table (v2.1, <span class="version updated">v2.10</span>). This function is required to return the ajax data obtained from your server into a useable format for tablesorter to apply to the table (v2.1, <span class="version updated">v2.14.3</span>).
<div class="collapsible"> <div class="collapsible">
<br> <br>
In <span class="version">v2.10</span>, the returned rows is now optional. And it can either be an array of arrays or a jQuery object (not attached to the table) In <span class="version">v2.10</span>, the returned rows is now optional. And it can either be an array of arrays or a jQuery object (not attached to the table)
@ -2753,7 +2753,8 @@ $.extend($.tablesorter.themes.jui, {
[ "rowNcell1", "rowNcell2", ... "rowNcellN" ] [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
], ],
[ "header1", "header2", ... "headerN" ] // optional [ "header1", "header2", ... "headerN" ] // optional
]</pre>Here is some example JSON (comments added, but not allowed in JSON) which is contained in the <a href="https://github.com/Mottie/tablesorter/blob/master/docs/assets/City0.json">City0.json</a> file: ]</pre><span class="label label-info">Note</span>: In <span class="version">v2.14.3</span>, the contents of the array can also contain table cell markup (i.e. <code>&quot;&lt;td class='green'&gt;+ 10%&lt;/td&gt;&quot;</code>).<br>
<br>Here is some example JSON (comments added, but not allowed in JSON) which is contained in the <a href="https://github.com/Mottie/tablesorter/blob/master/docs/assets/City0.json">City0.json</a> file:
<pre class="prettyprint lang-javascript">{ <pre class="prettyprint lang-javascript">{
// total rows // total rows
"total_rows": 80, "total_rows": 80,

View File

@ -464,8 +464,8 @@ tsp = ts.pager = {
for ( i = 0; i < l; i++ ) { for ( i = 0; i < l; i++ ) {
tds += '<tr>'; tds += '<tr>';
for ( j = 0; j < d[i].length; j++ ) { for ( j = 0; j < d[i].length; j++ ) {
// build tbody cells // build tbody cells; watch for data containing HTML markup - see #434
tds += '<td>' + d[i][j] + '</td>'; tds += /^\s*\<td/.test(d[i][j]) ? $.trim(d[i][j]) : '<td>' + d[i][j] + '</td>';
} }
tds += '</tr>'; tds += '</tr>';
} }