-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CSV export issue #2215 #2216
Conversation
2338f59
to
4734287
Compare
*/ | ||
$glue = apply_filters( 'gravityview/template/field/csv/glue', ';', $gravityview ); | ||
// It's the parent field, not an input | ||
if ( ! $is_single_input ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrcasual This is the same logic as in the field-checkbox-html.php
file.
@@ -173,7 +177,8 @@ function ( $field ) use ( $allowed_field_ids ) { | |||
// remove all links from output. | |||
$field->update_configuration( [ 'show_as_link' => '0' ] ); | |||
|
|||
$source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrcasual This was the cause of the bug - it always used the main form as the source, even when the field belonged to the joined form.
@Mwalek, please test. |
@mrcasual @zahardev the check marks no longer show as strings, but the CSV output is still not perfect. If you look at the row of "Mutale" in the screenshot below, you'll see that the check mark should be present on Nigeria and Sweden. However, when the CSV is exported, the check mark is present on Nigeria and Portugal, this is wrong. If you want to export any of my test data: https://test-notifs.try.gravitykit.com/wp-admin/post.php?post=19&action=edit (test:test) |
* @param GF_Field_Checkbox $field GravityView field. | ||
* @param Template_Context $gravityview The context. | ||
*/ | ||
$output = apply_filters( 'gravityview/template/field/csv/tick', '✓', $entry, $field, $gravityview ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zahardev, is there a reason why you didn't use the existing gravityview_field_tick
filter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrcasual The gravityview_field_tick
filter is used on web pages, and its default value is <span class="dashicons dashicons-yes"></span>
. We can't use this value in CSV exports as it won't convert to a tick symbol. That's why I added a new filter specifically for CSV handling. Please let me know if we can somehow improve it or use gravityview_field_tick
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification @zahardev! @mrcasual that explains why DataTables wasn't able to export the ticks (DT strips HTML), and I had to use an emoji in place: https://github.com/GravityKit/DataTables/issues/60#issuecomment-856311493
Just tried to check the issue on https://test-notifs.try.gravitykit.com, and it works correctly for me. Could you please try reproducing the issue once again? |
Hey @zahardev, I've narrowed down the issue. It only occurs when the download is initiated by adding https://test-notifs.try.gravitykit.com/view/combi-1/csv/ Please let me know if you can reproduce the issue when the URL above is used. |
Hey @Mwalek, thank you, I've managed to reproduce it locally. |
@Mwalek I've made a fix for it, could you please check if it works for you now? |
gravityview/template/field/csv/tick
) was added.💾 Build file (6603f79).