Availability of column filters for the raw data table


#1

Hi, I have a raw data table in a react app, but I added some UI buttons and selectors, so that the user can configure the raw data table in real time, but I’m wondering if there is a way to evaluate what the correct column filter is for a specific column depending on its type.


#2

Hello @ivan95, in the documentation there is a function to evaluate the column filter components available for the supported field types in the Raw data table, here is how you can use it:

const rdtFunc = cf.getVisualization('my-rdt').get('getColumnFilterSupport');

const colFilterSupport = rdtFunc();

That function will give you an array like this:

[
    {
        "name": "slicer",
        "supportedTypes": [
            "ATTRIBUTE",
            "INTEGER"
        ],
        "defaultTypes": [
            "ATTRIBUTE",
            "INTEGER"
        ]
    },
    {
        "name": "range",
        "supportedTypes": [
            "INTEGER",
            "NUMBER",
            "MONEY",
            "PERCENT"
        ],
        "defaultTypes": [
            "NUMBER",
            "MONEY",
            "PERCENT"
        ]
    },
    {
        "name": "datePicker",
        "supportedTypes": [
            "TIME"
        ],
        "defaultTypes": [
            "TIME"
        ]
    }
]

And with that you can decide how to use the column filter components


#3

I see that function could help me, but, I just have the name of the column, how can i use the array with that?


#4

Well, you should get the metadata fields then you will have the field name and its type, like in this example:

cf.getDatasourceMetadata('your_source','your_provider').then(meta => {
    const fields = meta.objectFields;

    // use the field types to get the defauld or supported column filter
});

#5

I did use the metadata fields and it was helpful, I didn’t know about this feature.

Thanks for your help.