jquery datatables превосходят экспорт, неправильно форматируя деньги - PullRequest
0 голосов
/ 04 февраля 2020

У меня есть jquery таблица данных, настроенная для экспорта, но значения неправильно форматируются в Excel: от $123.44 до 123.44 $

Код экспорта для кнопки Excel:

    this.vehiclesDataTable = $("#vehiclesTable").DataTable({
        destroy: true,
        responsive: true,
        buttons: [
            {
                extend: "excel",
                text: "Excel",
                filename: "VehiclesTable" + Math.random().toString().substring(0,12)
            }
        ],
        data: data,
        columns: this.dynamicColumns,
        order: [[1, "asc"]]
    });

Datatable:

<table id="vehiclesTable" class="table display dataTable table-striped vehiclesTable no-footer"
    style="margin-bottom: 20px !important; width: 100%;" role="grid" aria-describedby="vehiclesTable_info">
    <thead>
        <tr role="row">
            <th class="sorting_asc" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Type: activate to sort column descending" style="width: 76px;" aria-sort="ascending">Type
            </th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Feb '19: activate to sort column ascending" style="width: 41px;">Feb '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Mar '19: activate to sort column ascending" style="width: 41px;">Mar '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Apr '19: activate to sort column ascending" style="width: 41px;">Apr '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="May '19: activate to sort column ascending" style="width: 43px;">May '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Jun '19: activate to sort column ascending" style="width: 41px;">Jun '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Jul '19: activate to sort column ascending" style="width: 37px;">Jul '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Aug '19: activate to sort column ascending" style="width: 43px;">Aug '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Sep '19: activate to sort column ascending" style="width: 42px;">Sep '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Oct '19: activate to sort column ascending" style="width: 40px;">Oct '19</th>
            <th class="dataTableAlignRight sorting" tabindex="0" aria-controls="vehiclesTable" rowspan="1" colspan="1"
                aria-label="Nov '19: activate to sort column ascending" style="width: 43px;">Nov '19</th>
        </tr>
    </thead>
    <tbody>
        <tr role="row" class="odd">
            <td class="sorting_1">cross family</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
            <td class=" dataTableAlignRight">$799.00</td>
        </tr>
    </tbody>
    <tfoot></tfoot>
</table>

... Но все же строки в Excel выглядят так: enter image description here

Поэтому я ищу способ сохранить денежный формат.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...