Skip Navigation

[Resolved] Sort doesn’t work

This thread is resolved. Here is a description of the problem and solution.

Problem:
Want to sort a table in a view based on a column filled by several fields, based on two custom post type’s field.

Solution:
It might be possible using coding but I it would be little too complex. In our API we don't have any documented hook for wpv-heading:
https://toolset.com/documentation/programmer-reference/views-filters/

So if you really want to try it out, you need to search through Views code / files to find the hook OR To get to know about which Views Hooks are executed on the page (frontend or backend), I suggest you a good way to detect those, please use following plugin & its addon:
- Debug Bar: https://wordpress.org/plugins/debug-bar/
- Debug Bar Actions and Filters Addon: https://wordpress.org/plugins/debug-bar-actions-and-filters-addon/

Our doc explains more about this strategy (section: Troubleshooting): https://toolset.com/documentation/programmer-reference/toolset-hooks/

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by romanB-3 7 years, 2 months ago.

Assisted by: Noman.

Author
Posts
#568018

I am trying to: Sort table by column.

I expected to see: The table sorted.

Instead, I got: The table not sorted.

#568044

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Roman,

Thank you for getting in touch with us.

1. On which particular page, which particular section and which particular table column or field is not sorting correctly? Please add some screenshot as well.

2. Try to remove and re-add the filters / query filters again (specially the one having issue). Sometimes re-adding filters resolves such issues. OR please try to create a new basic test View with Table sort and see if filters work correctly in it?

Some related tickets and solutions:
https://toolset.com/forums/topic/sortable-table-in-views-not-sorting-post-title-alphabetically/
https://toolset.com/forums/topic/sortable-table-view-by-views_woo_price-not-working-correctly/

Thank you

#570461

It seems my problem is I need to sort a table based on a column filled by several fields, based on custom post type.
For instance post type A date field is called wpcf-A-date, and post type B date field is called wpcf-B-date.
So when filling the view for both custom post types A and B, I would need the column heading to be something like

[wpv-heading name="post-field-A-date,post-field-B-date"]Date[/wpv-heading]

How may I set this up ?
Thank you.

#570497

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Roman,

Views cannot handle double Ordering or Sorting by 2 custom fields. And this is limitation even if Custom Fields comes from one CPT or from 2 CPTs. A feature request was filed recently for having ordering / sorting by 2 custom fields.

The main issue is the level of complexity in this type of behavior which Views cant handle as of now. So I am afraid this won't be possible at moment.

Thanks

#570510

If I understand well, the data stored while making the sorting is set by the wpv-heading shortcode, and it has nothing to do with the content of the cells. Wouldn't it be possible to have more latitude to choose the data used for the sorting ? For instance with a hook or function ?
Thank you.

#570936

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Roman,

It might be possible using coding but I it would be little too complex. In our API we don't have any documented hook for wpv-heading:
https://toolset.com/documentation/programmer-reference/views-filters/

So if you really want to try it out, you need to search through Views code / files to find the hook OR To get to know about which Views Hooks are executed on the page (frontend or backend), I suggest you a good way to detect those, please use following plugin & its addon:
- Debug Bar: https://wordpress.org/plugins/debug-bar/
- Debug Bar Actions and Filters Addon: https://wordpress.org/plugins/debug-bar-actions-and-filters-addon/

==> Our doc explain more about this strategy (section: Troubleshooting): https://toolset.com/documentation/programmer-reference/toolset-hooks/

==> This will give you enough information about available filters that you can use to modify things after hooking into it. Thank you

#571038

Thank you very much ; that is great support.
I'll look into those.
Thanks again.