How to use the filefy.CsvBuilder function in filefy

To help you get started, we’ve selected a few filefy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github magma / magma / nms / app / packages / magmalte / app / views / subscriber / SubscriberTable.js View on Github external
async function exportSubscribers(props: ExportProps) {
  const {networkId, enqueueSnackbar} = props;
  let page = 1;
  let token = undefined;
  const currTs = Date.now();
  const subscriberExport = new CsvBuilder(`subscribers_${currTs}.csv`)
    .setDelimeter(',')
    .setColumns(SUBSCRIBER_EXPORT_COLUMNS.map(columnDef => columnDef.title));
  try {
    // last page next_page_token is an empty string
    while (token !== '') {
      // $FlowIgnore
      const subscriberRows: paginated_subscribers = await FetchSubscribers({
        networkId,
        token,
      });
      if (subscriberRows) {
        page = page + 1;
        token = subscriberRows.next_page_token;
      }
      const subscriberData = Object.keys(subscriberRows.subscribers).map(
        rowData =>
github magma / magma / symphony / app / fbcnms-projects / magmalte / app / views / equipment / GatewayLogs.js View on Github external
).then(logRows => {
    const data = logRows.map(rowData =>
      LOG_COLUMNS.map(columnDef => rowData[columnDef.field]),
    );

    const currTs = Date.now();
    new CsvBuilder(`logs_${currTs}.csv`)
      .setDelimeter(EXPORT_DELIMITER)
      .setColumns(LOG_COLUMNS.map(columnDef => columnDef.title))
      .addRows(data)
      .exportFile();
  });
}
github magma / magma / nms / app / packages / magmalte / app / views / equipment / GatewayLogs.js View on Github external
) {
  try {
    const logRows = await searchLogs(
      networkId,
      gatewayId,
      0,
      MAX_PAGE_ROW_COUNT,
      start,
      end,
      q,
    );
    const data = logRows.map(rowData =>
      LOG_COLUMNS.map(columnDef => rowData[columnDef.field]),
    );
    const currTs = Date.now();
    new CsvBuilder(`logs_${currTs}.csv`)
      .setDelimeter(EXPORT_DELIMITER)
      .setColumns(LOG_COLUMNS.map(columnDef => columnDef.title))
      .addRows(data)
      .exportFile();
  } catch (e) {
    enqueueSnackbar(e?.message ?? 'error retrieving logs', {variant: 'error'});
  }
}
github mbrn / material-table / src / components / m-table-toolbar.js View on Github external
defaultExportCsv = () => {
    const columns = this.props.columns
      .filter(columnDef => {
        return !columnDef.hidden && columnDef.field && columnDef.export !== false;
      })
      .sort((a, b) => (a.tableData.columnOrder > b.tableData.columnOrder) ? 1 : -1);
    const dataToExport = this.props.exportAllData ? this.props.data : this.props.renderData;
    const data = dataToExport.map(rowData =>
      columns.map(columnDef => {
        return this.props.getFieldValue(rowData, columnDef);
      })
    );

    const builder = new CsvBuilder((this.props.exportFileName || this.props.title || 'data') + '.csv');
    builder
      .setDelimeter(this.props.exportDelimiter)
      .setColumns(columns.map(columnDef => columnDef.title))
      .addRows(data)
      .exportFile();
  }
github mbrn / material-table / src / components / m-table-toolbar.js View on Github external
defaultExportCsv = () => {
    const columns = this.props.columns
      .filter(columnDef => {
        return !columnDef.hidden && columnDef.field && columnDef.export !== false;
      })
      .sort((a, b) => (a.tableData.columnOrder > b.tableData.columnOrder) ? 1 : -1);
    const dataToExport = this.props.exportAllData ? this.props.data : this.props.renderData;
    const data = dataToExport.map(rowData =>
      columns.map(columnDef => {
        return this.props.getFieldValue(rowData, columnDef);
      })
    );

    const builder = new CsvBuilder((this.props.exportFileName || this.props.title || 'data') + '.csv');
    builder
      .setDelimeter(this.props.exportDelimiter)
      .setColumns(columns.map(columnDef => columnDef.title))
      .addRows(data)
      .exportFile();
  }

filefy

A javascript library to produce downloadable files sucs as in CSV, PDF, XLSX, DOCX formats

MIT
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis

Popular filefy functions