How to use 'datatables export selected columns' in JavaScript

Every line of 'datatables export selected columns' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
246private getColumnHeaders(columns: Column[]): KeyTitlePair[] {
247 if (!columns || !Array.isArray(columns) || columns.length === 0) {
248 return null;
249 }
250 const columnHeaders = [];
251
252 // Populate the Column Header, pull the name defined
253 columns.forEach((columnDef) => {
254 let headerTitle = '';
255 if (columnDef.headerKey && this._gridOptions.enableTranslate && this.translate && this.translate.instant) {
256 headerTitle = this.translate.instant(columnDef.headerKey);
257 } else {
258 headerTitle = columnDef.name || titleCase(columnDef.field);
259 }
260 const skippedField = columnDef.excludeFromExport || false;
261
262 // if column width is 0, then we consider that field as a hidden field and should not be part of the export
263 if ((columnDef.width === undefined || columnDef.width > 0) && !skippedField) {
264 columnHeaders.push({
265 key: columnDef.field || columnDef.id,
266 title: headerTitle
267 });
268 }
269 });
270
271 return columnHeaders;
272}
Important

Use secure code every time

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


Related snippets