<commit_before>var gridOptions = {
    columnDefs: getInitialColumnDefs(),
    defaultColDef: {
        width: 110,
        filter: true
    },
    sideBar: 'filters',
    onDisplayedColumnsChanged: onDisplayedColumnsChanged
};

function getInitialColumnDefs() {
    return [
        { field: "athlete", filter: 'agTextColumnFilter' },
        { field: "age" },
        { field: "country" },
        { field: "year" },
        { field: "date" },
        { field: "sport" },
        { field: "gold" },
        { field: "silver" },
        { field: "bronze" },
        { field: "total" }
    ];
}

function onDisplayedColumnsChanged(params) {
    //get current column order
    var gridCols = params.columnApi.getAllGridColumns();
    var orderedGridColDefs = gridCols.map(col => col.getColDef());

    // update filters tool panel with new column order
    var filtersToolPanel = params.api.getToolPanelInstance('filters');
    filtersToolPanel.setFilterLayout(orderedGridColDefs);
}

function customFilters() {
    var customFilterLayout = [
        { field: "athlete" },
        { field: "country" },
        { field: "sport" },
        { field: "age" }
    ];

    var filtersToolPanel = gridOptions.api.getToolPanelInstance('filters');
    filtersToolPanel.setFilterLayout(customFilterLayout);
}

function sortedLayout(asc) {
    var copiedColDefs = getInitialColumnDefs().slice(); // don't mutate original

    var sortedColDefs = copiedColDefs.sort(function(d1, d2) {
        if (d1.field < d2.field) return asc ? -1 : 1;
        if (d1.field > d2.field) return asc ? 1 : -1;
        return 0;
    });

    var filtersToolPanel = gridOptions.api.getToolPanelInstance('filters');
    filtersToolPanel.setFilterLayout(sortedColDefs);
}<commit_msg>AG-3131 - removed lambda expression from custom filter layout example for Filters Tool Panel.<commit_after>var gridOptions = {
    columnDefs: getInitialColumnDefs(),
    defaultColDef: {
        width: 110,
        filter: true
    },
    sideBar: 'filters',
    onDisplayedColumnsChanged: onDisplayedColumnsChanged
};

function getInitialColumnDefs() {
    return [
        { field: "athlete", filter: 'agTextColumnFilter' },
        { field: "age" },
        { field: "country" },
        { field: "year" },
        { field: "date" },
        { field: "sport" },
        { field: "gold" },
        { field: "silver" },
        { field: "bronze" },
        { field: "total" }
    ];
}

function onDisplayedColumnsChanged(params) {
    //get current column order
    var gridCols = params.columnApi.getAllGridColumns();
    var orderedGridColDefs = gridCols.map(function(col) {
      return col.getColDef();
    });

    // update filters tool panel with new column order
    var filtersToolPanel = params.api.getToolPanelInstance('filters');
    filtersToolPanel.setFilterLayout(orderedGridColDefs);
}

function customFilters() {
    var customFilterLayout = [
        { field: "athlete" },
        { field: "country" },
        { field: "sport" },
        { field: "age" }
    ];

    var filtersToolPanel = gridOptions.api.getToolPanelInstance('filters');
    filtersToolPanel.setFilterLayout(customFilterLayout);
}

function sortedLayout(asc) {
    var copiedColDefs = getInitialColumnDefs().slice(); // don't mutate original

    var sortedColDefs = copiedColDefs.sort(function(d1, d2) {
        if (d1.field < d2.field) return asc ? -1 : 1;
        if (d1.field > d2.field) return asc ? 1 : -1;
        return 0;
    });

    var filtersToolPanel = gridOptions.api.getToolPanelInstance('filters');
    filtersToolPanel.setFilterLayout(sortedColDefs);
}
{'fraction_non_alphanumeric': 0.12745912995289554, 'fraction_numerical': 0.00886672208367969, 'mean_word_length': 2.8942826321467097, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5399579', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1089, 'n_words': 235}