protected List<UIColumn> getExportableColumns(T table) {
        if (exportableColumnsCache.containsKey(table)) {
            return exportableColumnsCache.get(table);
        }

        int allColumnsSize = table.getColumns().size();
        List<UIColumn> exportableColumns = new ArrayList<>(allColumnsSize);
        boolean visibleColumnsOnly = exportConfiguration.isVisibleOnly();
        Map<String, ColumnMeta> allColumnMeta = table.getColumnMeta();
        final List<ColumnMeta> exportableColumnsMetadata = new ArrayList<>(allColumnsSize);

        table.forEachColumn(true, true, true, column -> {
            if (column.isExportable()) {
                String columnKey = column.getColumnKey();
                ColumnMeta currentMeta = allColumnMeta.get(columnKey);
                // #9197 - if we have a column without metadata, we need to set it to 0
                if (currentMeta == null) {
                    currentMeta = new ColumnMeta(columnKey);
                    currentMeta.setVisible(true);
                    currentMeta.setDisplayPriority(column.getDisplayPriority());
                }
                // #7200 display visible columns only
                if (!visibleColumnsOnly || currentMeta.getVisible()) {
                    exportableColumnsMetadata.add(currentMeta);
                }
            }
            return true;
        });

        // #12731 sort by visible display priority
        Comparator<Integer> sortIntegersNaturallyWithNullsLast = Comparator.nullsLast(Comparator.naturalOrder());
        exportableColumnsMetadata.sort(Comparator.comparing(ColumnMeta::getDisplayPriority, sortIntegersNaturallyWithNullsLast));


        for (ColumnMeta meta : exportableColumnsMetadata) {
            String metaColumnKey = meta.getColumnKey();
            table.invokeOnColumn(metaColumnKey, -1, exportableColumns::add);
        }

        exportableColumnsCache.put(table, exportableColumns);

        return exportableColumns;
    }
Gets and caches the list of UIColumns that are exportable="true", visible="true", and rendered="true".
Orders them by displayPriority so they match the UI display of the columns.

@param table the Table with columns to export
@return the List<UIColumn> that are exportable
primefaces/src/main/java/org/primefaces/component/export/TableExporter.java