Found a kludge.

    # Remove sorting from specific columns.
    grid.elements('a', replace=remove_sorting)

which uses this function

def remove_sorting(html: gluon.HTML) -> Union[str, gluon.HTML]:
    """Remove HTML tag if it contains specific words.

    :param html: HTML.
    :return: Original HTML or text inside HTML tags w/specific words.
    """
    text = str(html)
    if ('power_supply' in text or 'automation' in text or 'doors' in text
            or 'sg_model_power' in text):
        return text.split('>')[1].split('<')[0]
    return html


Is there a better way?


sexta-feira, 29 de Março de 2019 às 11:31:08 UTC, João Matos escreveu:
>
> Is it possible to disable grid sorting for some columns only?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to