Skip to content
This repository was archived by the owner on Apr 18, 2020. It is now read-only.
This repository was archived by the owner on Apr 18, 2020. It is now read-only.

Data pre-processing #32

Open
Open
@robertmarney

Description

@robertmarney

In English locales it is common to separate thousands by using a comma ie 1000 -> 1,000, also for readability zeros are replaced with a '-' (see jquery datatables)

If you were to feed either of these numbers into the parser a NaN error would result with warning for end user.

Consider either a global or cell specific (when data type is numeric) processor.

A quick and dirty deals with the global (not ideal as there may be legitimate string uses for ','

function makeXLSXExport(tableId) {
  let table = document.querySelector("#"+tableId);
  let tableT = table.cloneNode(true);;
  tableT.innerHTML = tableT.innerHTML.replace(/,/g,''); //replaces , globally
  tableT.innerHTML = tableT.innerHTML.replace(/>-</g,'><'); //replaces cells only containing - globally
  TableToExcel.convert(tableT);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions