I am posted a similar question where I am getting a null or not an object
error on .hml() in IE
Perhaps you can help. I am trying to build a custom parser that will extract
the data from a span
ts.addParser({
id: "empnames",
is: function(s) {
return false;
},
format: function(s) {
var strobj = $($.trim(s));
return
strobj.find("span").html().toLowerCase();
},
type: "text"
});
In that case strobj.find("span") is an object but as soon as I add .html()
it returns null
in IE. It works fine in Safari and Firefox. I am using jQuery 1.3.2 and
tablesorter 2.0
If anyone has a better technique to do it it's also appreciated.
Thanks
aquaone wrote:
>
> There are two simple ways of fixing this: having a hidden span or similar
> element appearing within your td prior to the value or better to define
> your
> own parser.
>
> e.g.
> $.tablesorter.addParser({
> id: "commaNum",
> is: function(s) {
> return /^[\d-]?[\d,]*(\.\d+)?$/.test(s);
> },
> format: function(s) {
> return s.replace(/,/g,'');
> },
> type: 'numeric'
> });
>
> aquaone
> (yes, you could use a more precise regex...)
>
>
> On Wed, Apr 29, 2009 at 20:41, David Blomstrom
> <david.blomstrom@gmail.com>wrote:
>
>> I'm using jQuery's tablesorter.js to create tables with sortable rows. It
>> works fine on both text and numerals - but only if they have no commas.
>> For
>> example, the following column would sort properly:
>> 2
>> 18
>> 401
>> 3
>> 15
>> But this column...
>> 1,200
>> 408
>> 26,048
>> ...would sort like this:
>> 1,200
>> 26,048
>> 408
>> Does anyone know how to fix this?
>> I'm using PHP and MySQL to derive my data from a database table, using
>> the
>> following code:
>> $Area = number_format($row["Area"]);
>> Then I simply insert $Area in a dynamic table cell, like so...
>> <td>$Area</td>
>> I posted my JavaScript links below. Thanks for any tips!
>> * * * * *
>> <script src="http://MySite/js/jquery-1.3.1.min.js"
>> type="text/javascript"></script>
>> <script src="http://MySite/js/tablesorter/jquery.tablesorter.js"
>> type="text/javascript"></script>
>> <script language="JavaScript" type="text/JavaScript">
>> $(document).ready(function()
>> {
>> $("#myTable").tablesorter({ widgets: ['zebra']} );
>>
>> $("#triggerMS").click(function(){
>> $("#menuMS").show();
>> return false;
>> });
>> $("#menuMS").click( function(){
>> $("#menuMS").hide();
>> return true;
>> });
>>
>> $("#triggerReg").click(function(){
>> $("#menuReg").show();
>> return false;
>> });
>> $("#menuReg").click( function(){
>> $("#menuReg").hide();
>> return true;
>> });
>>
>> $("#triggerKids").click(function(){
>> $("#menuKids").show();
>> return false;
>> });
>> $("#menuKids").click( function(){
>> $("#menuKids").hide();
>> return true;
>> });
>>
>> $("#triggerLinks").click(function(){
>> $("#menuLinks").show();
>> return false;
>> });
>> $("#menuLinks").click( function(){
>> $("#menuLinks").hide();
>> return true;
>> });
>>
>> $("#triggerBooks").click(function(){
>> $("#menuBooks").show();
>> return false;
>> });
>> $("#menuBooks").click( function(){
>> $("#menuBooks").hide();
>> return true;
>> });
>>
>> }
>> );
>> </script>
>>
>> --
>> David Blomstrom
>> Writer & Web Designer (Mac, M$ & Linux)
>> www.geobop.org
>>
>
>
--
View this message in context: http://www.nabble.com/tablesorter.js-vs-Numerals-with-Commas-tp23309424s27240p23325353.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.
No comments:
Post a Comment