Quasar: body-cell-[name] slot should have precedence over body-cell slot

Created on 4 Jun 2020  路  5Comments  路  Source: quasarframework/quasar

First of all, thank you for great framework. 馃檹

Describe the bug
It is common that more specific things have precedence over general ones.. see CSS rules for example, and it makes sense why it is so.
Therefore I would expect also same for cell slots, named one should be applied over general one.
This is not happening and solving it makes a lot of extra code and effort.
I want to have some basic template for cell "body-cell slot" and in some cases, for some columns I need to override this by body-cell-[name] slot. It is not happening currently.

Codepen/jsFiddle/Codesandbox (required)
https://codepen.io/luckylooke/pen/PoZwqeB

To Reproduce

  • see the template, both slots are specified
  • see the result, only general one is applied

Expected behavior
template v-slot:body-cell-name to be applied for "name" column cells

Platform (please complete the following information):
any, codepen is platform agnostic I think

Additional context
I expect that same happen for header cells and should be corrected too.

I am willing to try to make MR during the weekend once one of the framework representatives will agree with the change.

Thank you, happy coding 馃憤

bug

Most helpful comment

Enhancement will be available in "quasar" v1.12.4.

All 5 comments

@luckylooke it's specified in the api description

body-cell: Slot to define how all body cells look like; Suggestion: QTd

what you could do is check for condition, ie. using body-cell-[name] https://codepen.io/metalsadman/pen/VweYjgR or using body-cell https://codepen.io/metalsadman/pen/OJMPRbX

Thank you @metalsadman for your input. I know this may be the option but I do not like it. Imagine that default cell is defined in some component and other are passed from outside, in such situation your solutions are getting even uglier... having correct precedence would produce nicer/cleaner/readable code. I have already checked the corresponding code and it does not seems to be difficult to make this happen.

Enhancement will be available in "quasar" v1.12.4.

You are amazing guys! 馃憦 馃憦 馃憦

Thank you for this enhancement, just a quick info related to this:
Now I can customize all the cells and a single cell in particular, but only the Q-TD.
If I need to customize the Q-TR (for a handling a click event for example) at this moment I can do this using the body slot, but this will override the other slots.

Is there a way to customize cells with their slot and at the same time customize the TR without rewriting all the body?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jigarzon picture jigarzon  路  3Comments

nueko picture nueko  路  3Comments

wc-matteo picture wc-matteo  路  3Comments

danikane picture danikane  路  3Comments

green-mike picture green-mike  路  3Comments