Dash DataTable - Conditional formatting within filtered view

I have code now that will highlight rows certain colors depending on a column value. I do this by generating a list of indeces that match this description, then iterating over it like so:

@app.callback(Output('live-update-table', 'style-data-conditional'),
def styler(n):
    style = []
    style.extend=([{'if':{'row_index':i},'background_color':'#de1738'} for i in indexlist])
   # add more styles as well
return style

I generate the list of indeces within styler by iterating over a global variable called data (the table data) which generated in another function with Output(‘live-update-table’,‘data’) and Input(‘interval-component’,‘n_intervals’). I then reference data in styler().
This doesn’t work if I use a filter on one of the columns.

I’m guessing that Dash doesn’t actually change this data variable when a filter is applied (which is smart). But my question still stands - how can I conditionally format within a filter view?

I’ve tried adding an additional Input(‘live-update-table’,‘filter_query’) to styler’s callback but there is still no change.

BTW - the filters aren’t just >num(0), they are below. Would handling these (if I even can) within app.layout DataTable() fix this issue? Please let me know how I can implement these if that’s the case! I’m very confused with the filter syntax there.

if i['Product] in productcodes
if i['Location'][0] in firstletterlist
if i['Location'][0] == '2' and len(i['Location']) == 4 and i['Location'][1:] != i['Destination']

I also have it set up to color in selected rows through a similar style.extend() iterating over selected_rows[0]. This also doesn’t work, probably for the same reason.

Figured it out - just use the derived_viewport_data Input in the callback, which also removes the need for the global variable.