alignChar: don't add align character when no content is right of it

This commit is contained in:
Mottie 2015-02-02 07:56:38 -06:00
parent 6521510e97
commit e3558664f8
2 changed files with 6 additions and 4 deletions

View File

@ -90,6 +90,7 @@ td:nth-child(3) .ts-align-right i {
<h3><a href="#">Notes</a></h3>
<div>
<ul>
<li>In <span class="version">v2.18.5</span>, if there is nothing to the right of the set align character, then the align character will not be added; this prevents hanging decimals like <code>3000.</code>.<p></p></li>
<li>This widget will <strong>only work</strong> in tablesorter version 2.8+ and jQuery version 1.7+.</li>
<li>The widget is still in "beta", so options &amp; functionality may change without warning; and, it has not been thoroughly tested!</li>
<li>Make sure to include the CSS shown below to maintain the alignment.</li>
@ -283,7 +284,7 @@ td:nth-child(3) .ts-align-right i {
</tr>
<tr>
<td>zyx 12</td>
<td>0.2</td>
<td>.2</td>
<td>Llama = llove it</td>
<td>http://aliens.nasa.gov/</td>
</tr>

View File

@ -83,10 +83,10 @@ ts.alignChar = {
for (rowIndex = 0; rowIndex < len; rowIndex++) {
alignChar = $(wo.alignChar_wrap).length ? $(wo.alignChar_wrap).html(v.align)[0].outerHTML : v.align;
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
last = right[rowIndex].slice(v.align.length);
$row.find('td').eq(v.column).html(
'<span class="ts-align-wrap"><span class="ts-align-left" style="' + wLeft + '">' + left[rowIndex] + '</span>' +
'<span class="ts-align-right" style="' + wRight + '">' + alignChar +
right[rowIndex].slice(v.align.length) + '</span></span>'
'<span class="ts-align-right" style="' + wRight + '">' + ( last.length ? alignChar + last : '' ) + '</span></span>'
);
}
}
@ -134,7 +134,8 @@ ts.addWidget({
c.$table.trigger('refreshAlign');
}
},
remove : function(table, c, wo){
remove : function(table, c, wo, refreshing){
if (refreshing) { return; }
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
ts.alignChar.remove(table, c, this.column);
});