[jQuery] Re: TableSorter issues: special characters, mixed data

2007-04-06 Thread Christian Bach

I checked in a new version that takes care of all the problems.

I based my test case on your example, located here:
http://lovepeacenukes.com/jquery/tests/tablesorter-mixed-data-types.html

/christian


2007/4/6, Kim Johnson [EMAIL PROTECTED]:



Err... I take that back.

-the only way for the page to not have javascript
errors is to put in the ExtractionType line, due to
the special characters in the title.

-however, by doing this, any time you sort any other
field, it still is sorting by title, not the field you
actually clicked.

--- Kim Johnson [EMAIL PROTECTED] wrote:

 Super close, but not quite! :)


http://anime-planet.com/users/reviewindex.php?usersid=1

 $(#userreviewtable).tableSorter({
 sortColumn: 'title',
 stripingRowClass: ['alt2','alt'],
   stripeRowsOnStartUp: true,
   textExtractionCustom: [
   [2,'integer']
   ],
   textExtractionType: ['title']
 });

 ExtractionType fixes the title issue -- those sort
 just fine now. I also changed the date to 4 digits
 and
 that works just fine (it didn't work with the date
 line you had mentioned for 2 digits). However, the
 Custom line still doesn't do anything for sorting
 the
 score field. (I removed the 0's, as normally those
 fields would be BLANK, as opposed to 0). I also
 tried
 changing [2, 'integer'] to 'decimal' or 'double', to
 no avail. Any ideas on this last tiny bit?

 thanks again,
 -kim

 --- Christian Bach [EMAIL PROTECTED]
 wrote:

  I took a look at your example page and this
 snippet
  will solve your problem:
 
  $(#userreviewtable).tableSorter({
  sortColumn: 'title',
  stripingRowClass: ['alt2','alt'],
  stripeRowsOnStartUp: true,
  textExtractionCustom: [
  [2,'integer']
  ],
  dateFormat: dd/mm/yy
  });
 
 
  What we are doing here is forcing the third column
  (we start counting at
  zero) to use the integer parser,
  since the column is messed up with the auto
  detection and identified as a
  text column (hey, no ones perfect).
 
  As regarding your date format 01/01/07 i have
 added
  this to the shortDate
  parser, however since the year is
  formatted with two digests the parser will parse
 07
  as 1997 since there is
  no way for it to know that you
  properly mean 2007. So my suggestion is to change
  this to a full 4 digit
  year format.
 
  If you do change the the year to a 4 digit format
  remove the dateFormat
  property from the tablesorter constructor.
 
 
  The new tablesorter version can be found here:
 


http://dev.jquery.com/browser/trunk/plugins/tablesorter/jquery.tablesorter.js?format=txt
 
  Best regards
  Christian
 
 
  2007/4/5, Kim Johnson [EMAIL PROTECTED]:
  
  
   Thanks Christian!
  
   I just pasted that in and indeed, now there
 isn't
  a JS
   error and it sorts correctly by title. However,
  now
   something strange is happening and the other
  fields
   don't sort -- they all sort by title! The date
   specifically is what I just tried.
  
   Here are two sample pages:
  
  
 

http://anime-planet.com/users/reviewindex.php?usersid=19
  
   ^^this page has always worked, because it has no
   special character names
  
  
 

http://anime-planet.com/users/reviewindex.php?usersid=1
   ^^the problem child page. The title does now
  work.
  
   Also, here's the tablesorter initialization:
  
   $(#userreviewtable).tableSorter({
   sortColumn: 'title',
   stripingRowClass: ['alt2','alt'],
   stripeRowsOnStartUp: true,
   textExtractionType: ['title']
   });
  
   And one other question: is it possible to do
  multiple
   columns for textExtraction (using a comma, two
   separate lines for it, etc)? There is one other
  column
   (score) that in theory should be able to have
  either
   nothing, or a number.
  
   Note: I'm still down with helping you on the
   documentation front :)
  
   thanks!
   -kim
  
   --- Christian Bach [EMAIL PROTECTED]
   wrote:
  
Kim, is it possible to publish a test page so
 i
  can
take a look?
   
   
A quick fix would be to use the new property
textExtractionType - which in
true tablesorter spirit is undocumented.
   
   
   
Here is a example:
   
This forces the tablesorter to extract data
 out
  of
the title attribute,
allowing a simple way to present mixed data to
  the
user
(string/numbers/etc).
   
script
$(table).tableSorter({
textExtractionType: ['title']
});
   
/script
table
thead
tr
thRow/th
thNumber/th
   
/tr
/thead
tbody
tr
td title=1One/td
td title=3030.00/td
/tr
tr
td title=22/td
td title=50a
  href=50.000/td
/tr
/tbody
/table
   
   
   
Best regards
Christian
   
   
2007/4/5, Kim Johnson [EMAIL PROTECTED]:


 Anyone know a workaround for this? :)
  Christian,
any
 thoughts?


=== 

[jQuery] Re: TableSorter issues: special characters, mixed data

2007-04-05 Thread Richard Thomas


Thats the hard part about trying to sort an already built table, I
prefer the other direction, build the tables off a set of data.. This
way you can do the formatting afterward and not have any issues.

http://projects.cyberlot.net/trac/jqpie/wiki/ExampleAuto




On 4/5/07, Christian Bach [EMAIL PROTECTED] wrote:

Kim, is it possible to publish a test page so i can take a look?


A quick fix would be to use the new property textExtractionType - which in
true tablesorter spirit is undocumented.



Here is a example:

This forces the tablesorter to extract data out of the title attribute,
allowing a simple way to present mixed data to the user
(string/numbers/etc).

script
$(table).tableSorter({
 textExtractionType: ['title']
});

/script
table
thead
tr
thRow/th
thNumber/th

/tr
/thead
tbody
tr
td title=1One/td
td title=3030.00/td
/tr
tr
td title=22/td
td title=50a href=50.000/td
/tr
/tbody
/table



Best regards
Christian


 2007/4/5, Kim Johnson [EMAIL PROTECTED]:

 Anyone know a workaround for this? :) Christian, any
 thoughts?

 -kim, who would really like to not code a bunch of
 tablesorting tonight in php ;)

 --- Kim Johnson  [EMAIL PROTECTED] wrote:

 
  ATTN: Christian or anyone else familiar :)
 
  I'm trying to use TableSorter for a few large
  batches
  of data, but am getting JS errors depending on what
  content is in the columns.
 
  For example:
 
  -Digit-only data works, but MIXED data (ex: some
  fields are empty, and some have decimal values)
  fails.
 
  -Special characters break the sorting. For example,
  I
  have a list of titles and some titles start with
  special characters (ex: .hack//SIGN, ~To Heart~).
  This
  also breaks.
 
  I suspect these are breaking because of something to
  do with the generic sorting function:
 
  generic: function(a,b) { return ((a[1]  b[1]) ? -1
  :
  ((a[1]  b[1]) ? 1 : 0)); }
 
  I usually use MYSQL's sorting mechanisms to filter
  queries (var1  var2) and this method works with
  special characters and such, so I'm not sure what
  the
  best way to modify the js file would be (for a
  temporary solution, until this is fixed in a
  subsequent release).
 
  Do you know of the reason why these cases are
  breaking, and/or what a good workaround would be?
 
  thanks,
  -kim
 
 
 
 
 


  No need to miss a message. Get email on-the-go
  with Yahoo! Mail for Mobile. Get started.
  http://mobile.yahoo.com/mail
 






 8:00? 8:25? 8:40? Find a flick in no time
 with the Yahoo! Search movie showtime shortcut.
 http://tools.search.yahoo.com/shortcuts/#news




--
POLYESTER*
Wittstocksgatan 2
115 24 Stockholm
Phone: 08-660 73 50 / +46-8-660 73 50
Mobile: 070-443 91 90 / +46-70-443 91 90
E-mail: [EMAIL PROTECTED]
http://www.polyester.se


[jQuery] Re: TableSorter issues: special characters, mixed data

2007-04-05 Thread Kim Johnson

Thanks Christian!

I just pasted that in and indeed, now there isn't a JS
error and it sorts correctly by title. However, now
something strange is happening and the other fields
don't sort -- they all sort by title! The date
specifically is what I just tried.

Here are two sample pages:

http://anime-planet.com/users/reviewindex.php?usersid=19
 
^^this page has always worked, because it has no
special character names

http://anime-planet.com/users/reviewindex.php?usersid=1
^^the problem child page. The title does now work.

Also, here's the tablesorter initialization:

$(#userreviewtable).tableSorter({
sortColumn: 'title',
stripingRowClass: ['alt2','alt'],
stripeRowsOnStartUp: true,
textExtractionType: ['title']
});

And one other question: is it possible to do multiple
columns for textExtraction (using a comma, two
separate lines for it, etc)? There is one other column
(score) that in theory should be able to have either
nothing, or a number. 

Note: I'm still down with helping you on the
documentation front :)

thanks!
-kim

--- Christian Bach [EMAIL PROTECTED]
wrote:

 Kim, is it possible to publish a test page so i can
 take a look?
 
 
 A quick fix would be to use the new property
 textExtractionType - which in
 true tablesorter spirit is undocumented.
 
 
 
 Here is a example:
 
 This forces the tablesorter to extract data out of
 the title attribute,
 allowing a simple way to present mixed data to the
 user
 (string/numbers/etc).
 
 script
 $(table).tableSorter({
 textExtractionType: ['title']
 });
 
 /script
 table
 thead
 tr
 thRow/th
 thNumber/th
 
 /tr
 /thead
 tbody
 tr
 td title=1One/td
 td title=3030.00/td
 /tr
 tr
 td title=22/td
 td title=50a href=50.000/td
 /tr
 /tbody
 /table
 
 
 
 Best regards
 Christian
 
 
 2007/4/5, Kim Johnson [EMAIL PROTECTED]:
 
 
  Anyone know a workaround for this? :) Christian,
 any
  thoughts?
 
  -kim, who would really like to not code a bunch of
  tablesorting tonight in php ;)
 
  --- Kim Johnson [EMAIL PROTECTED] wrote:
 
  
   ATTN: Christian or anyone else familiar :)
  
   I'm trying to use TableSorter for a few large
   batches
   of data, but am getting JS errors depending on
 what
   content is in the columns.
  
   For example:
  
   -Digit-only data works, but MIXED data (ex: some
   fields are empty, and some have decimal values)
   fails.
  
   -Special characters break the sorting. For
 example,
   I
   have a list of titles and some titles start with
   special characters (ex: .hack//SIGN, ~To
 Heart~).
   This
   also breaks.
  
   I suspect these are breaking because of
 something to
   do with the generic sorting function:
  
   generic: function(a,b) { return ((a[1]  b[1]) ?
 -1
   :
   ((a[1]  b[1]) ? 1 : 0)); }
  
   I usually use MYSQL's sorting mechanisms to
 filter
   queries (var1  var2) and this method works with
   special characters and such, so I'm not sure
 what
   the
   best way to modify the js file would be (for a
   temporary solution, until this is fixed in a
   subsequent release).
  
   Do you know of the reason why these cases are
   breaking, and/or what a good workaround would
 be?
  
   thanks,
   -kim
  
  
  
  
  
 
 


   No need to miss a message. Get email on-the-go
   with Yahoo! Mail for Mobile. Get started.
   http://mobile.yahoo.com/mail
  
 
 
 
 
 
 


  8:00? 8:25? 8:40? Find a flick in no time
  with the Yahoo! Search movie showtime shortcut.
  http://tools.search.yahoo.com/shortcuts/#news
 
 
 
 
 -- 
 POLYESTER*
 Wittstocksgatan 2
 115 24 Stockholm
 Phone: 08-660 73 50 / +46-8-660 73 50
 Mobile: 070-443 91 90 / +46-70-443 91 90
 E-mail: [EMAIL PROTECTED]
 http://www.polyester.se
 



 

Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/


[jQuery] Re: TableSorter issues: special characters, mixed data

2007-04-05 Thread Kim Johnson

Super close, but not quite! :)

http://anime-planet.com/users/reviewindex.php?usersid=1

$(#userreviewtable).tableSorter({
sortColumn: 'title',
stripingRowClass: ['alt2','alt'], 
stripeRowsOnStartUp: true,
textExtractionCustom: [
[2,'integer']  
],
textExtractionType: ['title']
});

ExtractionType fixes the title issue -- those sort
just fine now. I also changed the date to 4 digits and
that works just fine (it didn't work with the date
line you had mentioned for 2 digits). However, the
Custom line still doesn't do anything for sorting the
score field. (I removed the 0's, as normally those
fields would be BLANK, as opposed to 0). I also tried
changing [2, 'integer'] to 'decimal' or 'double', to
no avail. Any ideas on this last tiny bit?

thanks again,
-kim

--- Christian Bach [EMAIL PROTECTED]
wrote:

 I took a look at your example page and this snippet
 will solve your problem:
 
 $(#userreviewtable).tableSorter({
 sortColumn: 'title',
 stripingRowClass: ['alt2','alt'],
 stripeRowsOnStartUp: true,
 textExtractionCustom: [
 [2,'integer']
 ],
 dateFormat: dd/mm/yy
 });
 
 
 What we are doing here is forcing the third column
 (we start counting at
 zero) to use the integer parser,
 since the column is messed up with the auto
 detection and identified as a
 text column (hey, no ones perfect).
 
 As regarding your date format 01/01/07 i have added
 this to the shortDate
 parser, however since the year is
 formatted with two digests the parser will parse 07
 as 1997 since there is
 no way for it to know that you
 properly mean 2007. So my suggestion is to change
 this to a full 4 digit
 year format.
 
 If you do change the the year to a 4 digit format
 remove the dateFormat
 property from the tablesorter constructor.
 
 
 The new tablesorter version can be found here:

http://dev.jquery.com/browser/trunk/plugins/tablesorter/jquery.tablesorter.js?format=txt
 
 Best regards
 Christian
 
 
 2007/4/5, Kim Johnson [EMAIL PROTECTED]:
 
 
  Thanks Christian!
 
  I just pasted that in and indeed, now there isn't
 a JS
  error and it sorts correctly by title. However,
 now
  something strange is happening and the other
 fields
  don't sort -- they all sort by title! The date
  specifically is what I just tried.
 
  Here are two sample pages:
 
 

http://anime-planet.com/users/reviewindex.php?usersid=19
 
  ^^this page has always worked, because it has no
  special character names
 
 

http://anime-planet.com/users/reviewindex.php?usersid=1
  ^^the problem child page. The title does now
 work.
 
  Also, here's the tablesorter initialization:
 
  $(#userreviewtable).tableSorter({
  sortColumn: 'title',
  stripingRowClass: ['alt2','alt'],
  stripeRowsOnStartUp: true,
  textExtractionType: ['title']
  });
 
  And one other question: is it possible to do
 multiple
  columns for textExtraction (using a comma, two
  separate lines for it, etc)? There is one other
 column
  (score) that in theory should be able to have
 either
  nothing, or a number.
 
  Note: I'm still down with helping you on the
  documentation front :)
 
  thanks!
  -kim
 
  --- Christian Bach [EMAIL PROTECTED]
  wrote:
 
   Kim, is it possible to publish a test page so i
 can
   take a look?
  
  
   A quick fix would be to use the new property
   textExtractionType - which in
   true tablesorter spirit is undocumented.
  
  
  
   Here is a example:
  
   This forces the tablesorter to extract data out
 of
   the title attribute,
   allowing a simple way to present mixed data to
 the
   user
   (string/numbers/etc).
  
   script
   $(table).tableSorter({
   textExtractionType: ['title']
   });
  
   /script
   table
   thead
   tr
   thRow/th
   thNumber/th
  
   /tr
   /thead
   tbody
   tr
   td title=1One/td
   td title=3030.00/td
   /tr
   tr
   td title=22/td
   td title=50a
 href=50.000/td
   /tr
   /tbody
   /table
  
  
  
   Best regards
   Christian
  
  
   2007/4/5, Kim Johnson [EMAIL PROTECTED]:
   
   
Anyone know a workaround for this? :)
 Christian,
   any
thoughts?
   
-kim, who would really like to not code a
 bunch of
tablesorting tonight in php ;)
   
--- Kim Johnson [EMAIL PROTECTED] wrote:
   

 ATTN: Christian or anyone else familiar :)

 I'm trying to use TableSorter for a few
 large
 batches
 of data, but am getting JS errors depending
 on
   what
 content is in the columns.

 For example:

 -Digit-only data works, but MIXED data (ex:
 some
 fields are empty, and some have decimal
 values)
 fails.

 -Special characters break the sorting. For
   example,
 I
 have a list of titles and some titles start
 with
 special characters (ex: .hack//SIGN, ~To
   Heart~).
 This
 also breaks.

 I suspect these are breaking 

[jQuery] Re: TableSorter issues: special characters, mixed data

2007-04-05 Thread Kim Johnson

Err... I take that back.

-the only way for the page to not have javascript
errors is to put in the ExtractionType line, due to
the special characters in the title.

-however, by doing this, any time you sort any other
field, it still is sorting by title, not the field you
actually clicked. 

--- Kim Johnson [EMAIL PROTECTED] wrote:

 Super close, but not quite! :)
 

http://anime-planet.com/users/reviewindex.php?usersid=1
 
 $(#userreviewtable).tableSorter({
 sortColumn: 'title',
 stripingRowClass: ['alt2','alt'], 
   stripeRowsOnStartUp: true,
   textExtractionCustom: [
   [2,'integer']  
   ],
   textExtractionType: ['title']
 });
 
 ExtractionType fixes the title issue -- those sort
 just fine now. I also changed the date to 4 digits
 and
 that works just fine (it didn't work with the date
 line you had mentioned for 2 digits). However, the
 Custom line still doesn't do anything for sorting
 the
 score field. (I removed the 0's, as normally those
 fields would be BLANK, as opposed to 0). I also
 tried
 changing [2, 'integer'] to 'decimal' or 'double', to
 no avail. Any ideas on this last tiny bit?
 
 thanks again,
 -kim
 
 --- Christian Bach [EMAIL PROTECTED]
 wrote:
 
  I took a look at your example page and this
 snippet
  will solve your problem:
  
  $(#userreviewtable).tableSorter({
  sortColumn: 'title',
  stripingRowClass: ['alt2','alt'],
  stripeRowsOnStartUp: true,
  textExtractionCustom: [
  [2,'integer']
  ],
  dateFormat: dd/mm/yy
  });
  
  
  What we are doing here is forcing the third column
  (we start counting at
  zero) to use the integer parser,
  since the column is messed up with the auto
  detection and identified as a
  text column (hey, no ones perfect).
  
  As regarding your date format 01/01/07 i have
 added
  this to the shortDate
  parser, however since the year is
  formatted with two digests the parser will parse
 07
  as 1997 since there is
  no way for it to know that you
  properly mean 2007. So my suggestion is to change
  this to a full 4 digit
  year format.
  
  If you do change the the year to a 4 digit format
  remove the dateFormat
  property from the tablesorter constructor.
  
  
  The new tablesorter version can be found here:
 

http://dev.jquery.com/browser/trunk/plugins/tablesorter/jquery.tablesorter.js?format=txt
  
  Best regards
  Christian
  
  
  2007/4/5, Kim Johnson [EMAIL PROTECTED]:
  
  
   Thanks Christian!
  
   I just pasted that in and indeed, now there
 isn't
  a JS
   error and it sorts correctly by title. However,
  now
   something strange is happening and the other
  fields
   don't sort -- they all sort by title! The date
   specifically is what I just tried.
  
   Here are two sample pages:
  
  
 

http://anime-planet.com/users/reviewindex.php?usersid=19
  
   ^^this page has always worked, because it has no
   special character names
  
  
 

http://anime-planet.com/users/reviewindex.php?usersid=1
   ^^the problem child page. The title does now
  work.
  
   Also, here's the tablesorter initialization:
  
   $(#userreviewtable).tableSorter({
   sortColumn: 'title',
   stripingRowClass: ['alt2','alt'],
   stripeRowsOnStartUp: true,
   textExtractionType: ['title']
   });
  
   And one other question: is it possible to do
  multiple
   columns for textExtraction (using a comma, two
   separate lines for it, etc)? There is one other
  column
   (score) that in theory should be able to have
  either
   nothing, or a number.
  
   Note: I'm still down with helping you on the
   documentation front :)
  
   thanks!
   -kim
  
   --- Christian Bach [EMAIL PROTECTED]
   wrote:
  
Kim, is it possible to publish a test page so
 i
  can
take a look?
   
   
A quick fix would be to use the new property
textExtractionType - which in
true tablesorter spirit is undocumented.
   
   
   
Here is a example:
   
This forces the tablesorter to extract data
 out
  of
the title attribute,
allowing a simple way to present mixed data to
  the
user
(string/numbers/etc).
   
script
$(table).tableSorter({
textExtractionType: ['title']
});
   
/script
table
thead
tr
thRow/th
thNumber/th
   
/tr
/thead
tbody
tr
td title=1One/td
td title=3030.00/td
/tr
tr
td title=22/td
td title=50a
  href=50.000/td
/tr
/tbody
/table
   
   
   
Best regards
Christian
   
   
2007/4/5, Kim Johnson [EMAIL PROTECTED]:


 Anyone know a workaround for this? :)
  Christian,
any
 thoughts?

 
=== message truncated ===



 

Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.