Pegase745 / sqlalchemy-datatables

SQLAlchemy integration of jQuery DataTables >= 1.10.x (Pyramid and Flask examples)
MIT License
159 stars 67 forks source link

How to wary rendered column data according to condition? #140

Open lehtone1 opened 2 years ago

lehtone1 commented 2 years ago

I noticed that it is possible to do custom rendering for column with ColumnDT("<a href=''>" + User.id + "</a>"). How can I differ how the data is rendered according to a conditional? I would like to do something like this:

ColumnDT(
    if(User.id == 1):
        "<a href=''>" +  User.id + "</a>"
    else:
        User.id
)
lehtone1 commented 2 years ago

Ok got it. Apparently you need to just do it with columnDefs