092678f8f1
thanks @mtt-artis for reporting the issue https://github.com/sqlpage/SQLPage/pull/608#issuecomment-2439444243
31 lines
1005 B
Handlebars
31 lines
1005 B
Handlebars
<div class="my-2 {{class}}" {{#if id}}id="{{id}}"{{/if}}>
|
|
<a href="data:text/csv;charset=UTF-8,
|
|
{{~#if bom~}}
|
|
%EF%BB%BF{{! Byte order mark for Excel }}
|
|
{{~/if~}}
|
|
{{~#each_row~}}
|
|
{{~#if (eq @row_index 0)~}}{{! header }}
|
|
{{~#each this~}}
|
|
{{~url_encode (csv_escape @key ../../separator)~}}
|
|
{{~#if (not @last)~}}
|
|
{{default ../../separator ","}}
|
|
{{~/if~}}
|
|
{{~/each~}}
|
|
%0A{{! %0A = newline}}
|
|
{{~/if~}}
|
|
{{~#each this~}}
|
|
{{~url_encode (csv_escape this ../../separator)~}}
|
|
{{~#if (not @last)~}}
|
|
{{default ../../separator ","}}
|
|
{{~/if~}}
|
|
{{~/each~}}
|
|
%0A
|
|
{{~/each_row~}}
|
|
"
|
|
download="{{default filename title}}.csv"
|
|
class="btn btn-{{default color "primary"}}{{#if size}} btn-{{size}}{{/if}}">
|
|
{{~icon_img (default icon "download")~}}
|
|
{{default title "Download"}}
|
|
</a>
|
|
</div>
|