[Resuelto] Some columns do not work with column sorting
This support ticket is created hace 4 años, 11 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I have created a table view with column sorting, however, some columns do not work correctly.
Watch the video that I attached: enlace oculto enlace oculto
I looked at your site and could see the issue, but I couldn't see why it was occurring.
I noticed that some of the columns are for fields from parent posts and I expect they will not work, filtering (or ordering) by fields of related posts isn't supported.
However, some of the other columns that I would expect to work are not, so I've taken a copy of the site.
I'll install that locally to do some more testing, and then I'll get back to you with my findings.
Yes. Now the "printhead" column works. 🙂
Thank you very much Nigel.
It is a pity that Toolset does not work with columns of related items, however, since it does not work, how can the sorting capacity for these columns be disabled?
Nigel,
Have you been told how to disable the sort capacity of some columns?
Another thing, since you cannot order a field related column, I wanted to put the "id of the mandril" that must be stored directly in the custom type "impresoras". However I could not put it in a simple way, I could only put it in related mode, so it has the same problem as showing the name of the related field. enlace oculto
Look at the screenshot.
I'm still waiting for advice about whether it is possible to disable the sorting functionality on individual columns where sorting is not supported, when I get some further information I'll share it with you.
Sorting can only work on direct fields of the post type being displayed.
I'm not sure how you are adding the "id of the mandrill", but if it is using relationships sorting is not going to work, because it is not supported.
You would need to add a custom field to store the ID.
You could manually add the ID values when saving the posts. If these are related and you have the post relationships section on the edit screen you should be able to see the ID, where you can then add it, though this would be cumbersome for many posts.
You could use the WordPress save_post hook to do it automatically, so that if saving a post of the relevant type, you used the Relationships API to get the ID of the connected post and then saved this as a custom field value, which you could then add as a column to the table.
My colleague in second tier identified what looks like a bug when the sortable table includes a column from a related post, and has escalated that to the developers for further investigation, so it may be that a solution could be provided for this, but I can't say just yet.
Nigel,
Seriously? Would all that have to be done to get the id that is supposed to be contained within the field? (since otherwise I could not find the Toolset relationship)
This is very strong, if not, quite unfortunate. 🙁
Thanks.
Regards,
The Post Reference field is effectively a relationship, and the data connecting the posts is stored in the relationship custom database tables, not standard post tables.
Hence the suggestion about "duplicating" the record by saving the fabricante post ID in a custom field of the impresora posts. If you wanted to do that I could help with the code that uses the save_post hook to do it automatically.
Check that the slugs are okay. This assumes you will save a Types custom field "parent-id" to store the related fabricante (the field is saved with a 'wpcf-' prefix in wp_postmeta).
Meanwhile, I'll let you know if there are any updates from the developers.