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.
246 private 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 }