jQuery tablesorter-在带括号的浮动上排序
我有一个HTML表,因此:jQuery tablesorter-在带括号的浮动上排序,jquery,jquery-plugins,tablesorter,Jquery,Jquery Plugins,Tablesorter,我有一个HTML表,因此: <table id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0" cellspacing="1"> <thead> <tr> <th>Checkbox</th> <th>Price delta</th> &
<table id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
<th>Checkbox</th>
<th>Price delta</th>
<th>Price range</th>
<th>Price brackets</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" id="chk1" name="chk1" value="Y" /></td>
<td><span class="price_up">Price up</span></td>
<td>(999.08) - (1025.67)</td>
<td>(1025.67)</td>
</tr>
<tr>
<td><input type="checkbox" id="chk2" name="chk2" value="Y" /></td>
<td><span class="price_down">Price down</span></td>
<td>(9.08) - (10.67)</td>
<td>(9.08)</td>
</tr>
<tr>
<td><input type="checkbox" id="chk3" name="chk3" value="Y" /></td>
<td><span class="price_up">Price up</span></td>
<td>(87.48) - (92.98)</td>
<td>(87.48)</td>
</tr>
<tr>
<td><input type="checkbox" id="chk4" name="chk4" value="Y" /></td>
<td><span class="price_up">Price up</span></td>
<td>(1.02) - (3.45)</td>
<td>(3.45)</td>
</tr>
<tr>
<td><input type="checkbox" id="chk5" name="chk5" value="Y" /></td>
<td><span class="price_down">Price down</span></td>
<td>(21.01) - (72.09)</td>
<td>(72.09)</td>
</tr>
<tr>
<td><input type="checkbox" id="chk6" name="chk6" value="Y" /></td>
<td><span class="price_up">Price up</span></td>
<td>(875) - (900)</td>
<td>(900)</td>
</tr>
</tbody>
</table>
但它似乎不起作用。已使用以下解析器对其进行排序:
// bracketed float parser
$.tablesorter.addParser({
// set a unique id
id: 'floatBracket',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s,table,cell) {
// format your data for normalization
var cellTxt = s.replace("(", "").replace(")", "");
return cellTxt;
},
// set type, either numeric or text
type: 'floating'
});
// bracketed float parser
$.tablesorter.addParser({
// set a unique id
id: 'floatBracket',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s,table,cell) {
// format your data for normalization
var cellTxt = s.replace("(", "").replace(")", "");
return cellTxt;
},
// set type, either numeric or text
type: 'floating'
});