Hi,

Great plugin. Loved Table Reloaded but this one is even better.

I was setting up a table with 10 rows and noticed a sorting issue.

I have one colomn as a rank (1 to 10).

When I sort on rank I get the following ordering:

1

10

2

3

4

5

6

7

8

9

How can I make it to sort '10' after '9' instead of after '1'

http://wordpress.org/extend/plugins/tablepress/

Hi,

thanks for your question, and sorry for the trouble.

The reason for this is that the content of the cells in that column could not be detected all the ways as "numeric". This is usually happens, if a cell in that column (besides the head cell) contains a character or letter that is not a number, or if a cell contains HTML code.

Could you please check that on your table? If that does not help, please post a link to the page with the table, and I'll take a direct look. Thanks!

Regards,

Tobias

Hi,

Ah. I guess that's it, but don't know how to get it working.

I now also installed the TablePress Extension: DataTables HTML Numbers in Tables but how do I configure/set this up?

I my rank I have numbers only and one cell with

1 <img src="/image.gif"/>

So the other cells are:

2

3

4

5

etc.

Hi,

please post a link to the page with the table then. Thanks!

Regards,

Tobias

Hi,

thanks for the link. Please try changing your "Custom Commands" to

`"aoColumnDefs": [ { "sType": "num-html", "aTargets": [ 0, 2, 4 ] } ]`

Regards,

Tobias

thanks.

I note that: 0=colomn 1 and 2=colomn 3

Hi,

sure, no problem! Good to see that this is working now! :-)

And yes, counting starts with 0, so 0=column 1 and so on.

Best wishes,

Tobias

Hi Tobias,

I too have this problem and the reason is that I have numbers and letters in the same rows. Is there any way to sort this so that the numbers display in order properly. The columns have to contain "no data yet" shortened to "NDY" as the table wouldn't make sense if I used a 0 in place of this, as the data would be misleading. If there is no fix around this what other character (other than a zero) will work?

Any help would be much appreciated.

Cheers

Chris

Hi Chris,

thanks for your post, and sorry for the trouble.

The reason for this is indeed the "NDY" in those columns. As those are not numerical, the sorting library doesn't really know what to do and fails.

You could try using the TablePress DataTables Sorting plugins Extension from http://tablepress.org/extensions/datatables-sorting-plugins/

Then, just add a "Custom Command" like

`"aoColumnDefs": [ { "sType": "formatted-num", "aTargets": [ 0, 2, 4 ] } ]`

with the column numbers adjusted as explained above.

Regards,

Tobias

Hi Tobias,

Thank you for your very prompt response,

Unfortunately the above suggestion didn't work. The columns are still sorting funny. I have had a look at the datatables site and notice that there is a "natural sorting" method described, however I am at a loss as to how to implement this with the sorting plugin. Would you have any suggestions?

Many thanks

Chris

Hi Chris,

can you please post a link to the page with the table, so that I can take a direct look?

And from what I can see, the "natural sorting" method will also not really help here. The problem is that "NDY" is not a numerical value, so the JS does not know how to handle that: Is "NDY" smaller than 1? Or is it more like infinity? And because it doesn't know that, the sorting fails.

Regards,

Tobias

Hi Tobias,

Many thanks again for getting back in touch. "NDY" is shorthand for "No Data Yet". The table is used to display financial information and therefore the use of 0 isn't applicable in certain circumstances. You can view a demo if the table at the link below. ANy further help would be much appreciated.

Table link

All the best

Chris

**gravesend47**

Member

Posted 1 year ago #

Hi Tobias,

I am in a similar situation.

I compile football appearance statistics, so mine have a () symbols and a + symbol to denote substitutions and also the word 'pens' to denote penalties.

For example:

Player A 9 (+7)

Player B 132 (+1)

Player C 42 (7 pens)

How would I go about sorting those? Thanks!

Hi,

Sorry for the late answer. As I was on vacation, I didn't have a chance to reply earlier.

@Chris: I understand what NDY stands for, but the JavaScript code doesn't. It can only interpret numbers, and just doesn't know how to handle NDY...

@gravesend: Well, you would have to write a custom sorting algorithm for the DataTables JavaScript library, that extracts the relevant number for sorting of that column. Unfortunately, this will require some custom coding, I'm afraid. The DataTables documentation at http://www.datatables.net should be a good starting point.

Regards,

Tobias