Is it possible to have a condition based class on a column in a q-table?



  • Is it possible to have a condition based class on a column in a q-table? Condition based on the bound content of the column cell.



  • Can you explain your problem in a bit more detail please?

    Scott



  • Sure, I have a column “Is Active” in a q-table that has a value of either ‘true’ or ‘false’. I want to apply a class of “alertRed” to the column cell when the value of the cell is ‘false’. I was hoping to do it natively in Quasar in the column definition, as opposed to using something like JQuery.



  • Was hoping something like this was possible:
    {
    name: ‘IsActive’,
    label: ‘Account Is Active’,
    field: ‘IsActive’,
    sortable: true,
    classes: (val) => {
    return (val == true) ? [] : [‘red’];
    }
    },



  • You can try that, but you can and probably should just use the slot available for QTd. Sorry, I should have asked earlier, but which version are you using?

    Scott


Log in to reply