Tabulator (Align and Sort)

Hello everyone,

I love tabulator, for me it is the widget that was missing !!! Very happy.
Quick question: I am having a hard time trying to find out how to align the columns, they are all left aligned, but I’d like to center some and right align some numbers. What did I miss?

Another tabulator related: can I hide the sorting arrow on column headings?

Thanks,
TM

1 Like

Hello,

another Tabulator question: I need the ‘editable’ that takes a function in Tabulator and I noticed it is not implemented into python (it is just a boolean). I would like to check if I can do it in the same way as the Style, so it receives a python callback function:

styled.style.applymap(color_negative_red).apply(highlight_max)

Does anyone know where is the applymap / apply functions so I can give it a read and see how it was done?

Rgds,
TM

Hi @miliante

You can find the Tabulator .py code here panel/tables.py at 87f4a44aa5dfb3b3f0a5986335abd1ae15c9eb6f · holoviz/panel · GitHub

and the Tabulator .ts code here panel/tabulator.ts at master · holoviz/panel (github.com)

Hi @miliante

Two suggestions. Perhaps, you’re already aware of the below link on the original Tabulator style. You can look up all the CSS element’s default name and customise your style, etc.

Tabulator - CSS Styling

Example snippet to go into your css variable:
.tabulator {background-color: transparent;}

Another, although I’m not convinced it will work. Use the style.style.applymap… method you quoted to identify the items but instead of changing the color property, change text-align, if that makes sense.

Something like the below.

def align_items(val):
    if val >= 368:
        align = 'left'
    elif val < 368 and val >= 331:
        align = 'right'
    else:
        align = 'center'
    return 'text-align: %s' % align