Hi Matías,
thanks for your question.
Yes, you can achieve this with an additional Shortcode parameter. That parameter is the “hide_columns” and “show_columns” parameter.
All parameters are explained in the documentation at http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/documentation/.
The parameter for the automatic sorting on the second column is “datatables_customcommands” (that parameter is basically the same as filling the “Custom Commands” textfield in the “DataTables Features” section on the “Edit” screen, just on a per-Shortcode-basis).
You will want to give that parameter the value
'aaSorting': [[1,'asc']]
So, in total, you will likely be using a Shortcode like this:
[table id=1 hide_columns="all" show_columns="1,3" datatables_customcommands="'aaSorting': [[1,'asc']]" /]
This will (with the special value “all” first hide all columns and then only show the the first and third columns (that number is what you will need to change to get the GOALS or POINTS column).
The customcommands parameter should then set the initial sorting.
Best wishes,
Tobias
Thanx for the inmediat response. The shortcode you suggest is not working, it shows not in the order, and at the bottom of the table it shows this:
]” /]
Hi,
argh, yes… As it seems, it is not possible that arguments in a Shortcode also use the ] character, as WordPress seems to think that this marks the end of the Shortcode.
Please try again with this one, which escapes the ] with a \. Just an idea, but likely it does not work either.
[table id=1 hide_columns="all" show_columns="1,3" datatables_customcommands="'aaSorting': \[\[1,'asc'\]\]" /]
If that does not work either, you will need to use the version of the Shortcode without that parameter:
[table id=1 hide_columns="all" show_columns="1,3" /]
and additionally paste the command
"aaSorting": [[1,'asc']]
into the “Custom Commands” textfield in the “DataTables Features” section on the “Edit” screen of the table.
This will have the same effect. However, this will mean that the large table (with all columns) will automatically be sorted for the second column…
Regards,
Tobias
Perfect! That works, but I have a problem, when i display the complete table with all the columns it is order by the secondone, is the any way to disable the “aaSorting”: [[1,’asc’]] with the shortcode?
Hi,
that’s what I meant with my last sentence in the previous post.
And after checking the code again: Yes, fortunately, you can disable that again with the Shortcode parameter 🙂
Just add the parameter with an empty value to the Shortcode which displays the large table, so that it becomes
[table id=1 datatables_customcommands="" /]
This should work as there are no ] in the parameter.
Regards,
Tobias
Hi Tobias, I want to add another thing to this, I want to be shown only the first 10 files, like the top ten. Is that possible? Thanx!
Hi,
you could either use the pagination feature for this (then one can still view the other ones, but they are hidden initially), or you use the “show_rows” and “hide_rows” Shortcode parameters (see the documentation) to only show those ten rows. You could also hide rows through the “Hide row” feature on the “Edit” screen.
(As a side note: If you use this, you will need to uncheck the “Cache Table Output” checkbox!)
Regards,
Tobias
Tobias,
I think this will solve the question i asked you from my other post about “rankings” staying frozen =)