Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery tablesorter generates error in custom parser for type text when input is numeric
    primarykey
    data
    text
    <p>I have a simple tablesorter in which I have written my own parser for a column. On the PhP side, I generate a data attribute whose value is used as the sort value for the cell. My problem is that in the custom parser, when I return the Data-... value, it gives me an error on an integer value, when type specified for the custom parser is text. One would normally expect such errors the other way around. The error on the console generated by tablesorter.js is </p> <pre><code> Uncaught TypeError: Object 11 has no method 'replace' </code></pre> <p>Where 11 is the numeric value assigned to data-skaddress attribute of the cell. </p> <pre><code> $.tablesorter.addParser({ id: 'skaddress', is: function(s) { return false; }, format: function(s, table, cell, cellIndex) { return $(cell).data('skaddress'); }, type: 'text' // &lt;&lt;&lt;&lt;-------- If this is changed to 'numeric', all is well }); </code></pre> <p>In other words, if I have a numeric value assigned to data-skaddress attibute of the cell it fails when I think that 'text' type simply means that any string, including all digits, would be considered a text field. The HTML markup of the cell generating the error is:</p> <pre><code> &lt;td data-ssipaddress="11"&gt;12.29.14.97.190.111&lt;/td&gt; </code></pre> <p>Any way around this? Spent a lot of time trying to find a real solution. Of course, there are workarounds. I can, for example, always generate a fixed alphabet before the long numeric string on the PhP side. The reason that I need a text field and not a numeric field is because my strings consist of long series of digits though in the example I am using only two digit strings.</p> <p>Please do not ask me to use Datatables instead. I like tablesorter (the one maintained by Mottie?) as it is light weight and great for what I need and infact I think better than Datatables in some aspect. It took me some time to get a hang of it. Just this unexpected problem...</p> <p><strong>Update:</strong> It works if a leading zero is placed before the string of digits assigned to data- attribute!</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload