Hello @AnnMarieW
I have an example app below that I believe can use a custom filter component if possible (using textMatcher was just an idea in case it can also work somehow). What I’m wanting to do is very niche so I understand if the reasoning doesn’t make sense. For this example, I’m wanting to show a parent row with all of its children if a filter for a column passes. So if I filter the “Employment Type” column for “contains Contract” I want to see everyone under Brittany Hanson and Francis Strickland. (I know it seems weird, but I do want to see everyone under the parent.)
import dash_ag_grid as dag
from dash import Dash, Input, Output, html, dcc
import dash_bootstrap_components as dbc
import os
app = Dash(__name__)
rowData = [
{
"orgHierarchy": ["Erica Rogers"],
"jobTitle": "CEO",
"employmentType": "Permanent",
},
{
"orgHierarchy": ["Erica Rogers", "Malcolm Barrett"],
"jobTitle": "Exec. Vice President",
"employmentType": "Permanent",
},
{
"orgHierarchy": ["Erica Rogers", "Esther Baker"],
"jobTitle": "Director of Operations",
"employmentType": "Permanent",
},
{
"orgHierarchy": [
"Brittany Hanson",
],
"jobTitle": "Fleet Coordinator",
"employmentType": "Permanent",
},
{
"orgHierarchy": [
"Brittany Hanson",
"Leah Flowers",
],
"jobTitle": "Parts Technician",
"employmentType": "Contract",
},
{
"orgHierarchy": [
"Brittany Hanson",
"Tammy Sutton",
],
"jobTitle": "Service Technician",
"employmentType": "Contract",
},
{
"orgHierarchy": [
"Brittany Hanson",
"Derek Paul",
],
"jobTitle": "Inventory Control",
"employmentType": "Permanent",
},
{
"orgHierarchy": ["Francis Strickland"],
"jobTitle": "VP Sales",
"employmentType": "Permanent",
},
{
"orgHierarchy": [
"Francis Strickland",
"Morris Hanson",
],
"jobTitle": "Sales Manager",
"employmentType": "Permanent",
},
{
"orgHierarchy": [
"Francis Strickland",
"Todd Tyler",
],
"jobTitle": "Sales Executive",
"employmentType": "Contract",
},
{
"orgHierarchy": [
"Francis Strickland",
"Bennie Wise",
],
"jobTitle": "Sales Executive",
"employmentType": "Contract",
},
{
"orgHierarchy": [
"Francis Strickland",
"Joel Cooper",
],
"jobTitle": "Sales Executive",
"employmentType": "Permanent",
},
]
grid = html.Div(
[
dag.AgGrid(
id="tree-data-example",
columnDefs=[
# we're using the auto group column by default!
{"field": "jobTitle"},
{"field": "employmentType"},
],
defaultColDef={
"flex": 1,
"filter": 'agTextColumnFilter'
},
dashGridOptions={
"autoGroupColumnDef": {
"headerName": "Organisation Hierarchy",
"minWidth": 300,
"cellRendererParams": {
"suppressCount": True,
},
},
"groupDefaultExpanded": -1,
"getDataPath": {"function": "getDataPath(params)"},
"treeData": True,
},
rowData=rowData,
enableEnterpriseModules=True,
licenseKey = os.environ['AGGRID_ENTERPRISE'],
style={'height': 600}
),
]
)
app.layout = html.Div(
[
dcc.Markdown("Example: Organisational Hierarchy using Tree Data "),
grid,
]
)
if __name__ == "__main__":
app.run(debug=True)
To run this example, include the following in the dashAgGridFunctions.js file in your app’s assets folder
var dagfuncs = window.dashAgGridFunctions = window.dashAgGridFunctions || {};
dagfuncs.getDataPath = function (data) {
return data.orgHierarchy;
}
Thanks for any direction you can provide!