Question on postprocessing argument #8

Open
opened 2021-08-18 15:34:52 +00:00 by ezolboo · 1 comment

Hello,

I dont know if I should have posted this here but I dont know where else to ask.

It says on the wiki:

Note that the {}-expressions allowed in the entries of the table definition include arbitrary Pods "magic tags" syntax. So for example in my installation, which categorizes articles from a periodical, I have such expressions as {@issue.issue_number} and {@section.permalink}. You can also use the custom postprocessing argument, e.g. {@source, list_of_links_to_terms} (where "list_of_links_to_terms" is defined in the functions.php of my theme).

Can you provide an example of how this can be used?

I have the following table (attached) for managing procurements and I need to remove the link for rows that dont have "НЭЭЛТТЭЙ" on the 3rd column.

Or can I use this to show the rows that have "НЭЭЛТТЭЙ" to the top with this?

Thanks.

Hello, I dont know if I should have posted this here but I dont know where else to ask. It says on the wiki: > Note that the {}-expressions allowed in the entries of the table definition include arbitrary Pods "magic tags" syntax. So for example in my installation, which categorizes articles from a periodical, I have such expressions as {@issue.issue_number} and {@section.permalink}. You can also use the custom postprocessing argument, e.g. {@source, list_of_links_to_terms} (where "list_of_links_to_terms" is defined in the functions.php of my theme). Can you provide an example of how this can be used? I have the following table (attached) for managing procurements and I need to remove the link for rows that dont have "НЭЭЛТТЭЙ" on the 3rd column. Or can I use this to show the rows that have "НЭЭЛТТЭЙ" to the top with this? Thanks.
Owner

Asking here is totally fine! Happy to help. Are you able to share the Tablepress table contents that is producing this table (Both images attached to the issue looked the same to me, but a screen shot of the Tablepress view could be really helpful.)

In any case, are you trying to filter the rows that are produced, reorder them, or modify the data in the rows exactly as they are shown now (without filtering or reordering them)?

In case of reordering, I believe Tablepress has some options that allow you to reorder the table rows in the view, and I would recommend using those.

In case of filtering, there is a pod_where argument to the [table] short code that allows you to specify a filter condition on the rows that will be displayed; it is documented in the code in tablepress-pods.php.

In case of modifying the generated data, that is where the optional custom postprocessing argument in the magic code in the table can help. It is just the name of a PHP function defined in your Wordpress installation (so easiest place to put it is functions.php of your theme). The function will be called with one argument, the value the magic code is going to produce, and it should return whatever you want to replace that value. (Note that depending on the exact magic code, that value might be a string or a list.)

Feel free to post if you need further help? I will leave this issue open with an "FAQ" tag so that others who have similar questions can find it easily. Thanks!

Asking here is totally fine! Happy to help. Are you able to share the Tablepress table contents that is producing this table (Both images attached to the issue looked the same to me, but a screen shot of the Tablepress view could be really helpful.) In any case, are you trying to _filter_ the rows that are produced, _reorder_ them, or _modify_ the data in the rows exactly as they are shown now (without filtering or reordering them)? In case of reordering, I believe Tablepress has some options that allow you to reorder the table rows in the view, and I would recommend using those. In case of filtering, there is a pod_where argument to the [table] short code that allows you to specify a filter condition on the rows that will be displayed; it is documented in the code in tablepress-pods.php. In case of modifying the generated data, that is where the optional custom postprocessing argument in the magic code in the table can help. It is just the name of a PHP function defined in your Wordpress installation (so easiest place to put it is functions.php of your theme). The function will be called with one argument, the value the magic code is going to produce, and it should return whatever you want to replace that value. (Note that depending on the exact magic code, that value might be a string or a list.) Feel free to post if you need further help? I will leave this issue open with an "FAQ" tag so that others who have similar questions can find it easily. Thanks!
glen added the
FAQ
label 2021-08-20 22:16:46 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: glen/tablepress-pods#8
No description provided.