Combining fixed and dynamic classes in Alpine.bind() #4078
Unanswered
docdunning
asked this question in
1. Help
Replies: 1 comment 1 reply
-
It's just that both end up becoming a Just have the one and return just what you want in it. No need for two. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Alpine.bind() to add attributes to table header cells.
<th x-bind="sortCol('name')">Name</th>
It works OK apart from the classes. I want the element always to have the class
cursor
, and maybe alsosortcol
. As I have it above, thesortcol
class is being applied correctly when necessary, but thecursor
class is never being applied - like it's being overridden by the:class
function.I know I could do this:
But
:class
is supposed to supplement, not replaceclass.
What am I doing wrong?Beta Was this translation helpful? Give feedback.
All reactions