Skip to content
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

customize export columns #16

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

itsmicaio
Copy link

This PR adds possibility to customize columns.

how to use:

  • create array of columns:
const exportColumns = [
  {
    name: 'coupon',
    key: 'code', // key of record param
    callback: (value: string) => `30#${value}`, // optional callback to transform data
  },
  {
    name: 'name',
    concat: { // concat a list of record params by param key
      keys: ['firstName', 'lastName'],
      separator: ' ',
    },
  },
  {
    name: 'products',
    concat: { // concat an array record param
      key: 'products',
      separator: ', ',
    },
  }
]
  • add options to feature builder
const adminJsOptions = {
...
    features: [
      importExportFeature({
        export: {
          columns: exportColumns
        },
        import: {
          isVisible: false
        }
      })
    ],
...
}

@itsmicaio itsmicaio marked this pull request as ready for review January 19, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant