You need to sign in to do that
Don't have an account?
Merci 10
how to change style to this element in LWC
I have the following requirement. I have to change styles of the second element rendered of this list, i tried a solution to do that but doesn't work, can you help me please?
data = {
issues: [
{
'chapter' : 'something1'
'posiion': '2A'
},
{
'chapter': 'something2',
'position' : '3A'
},
{
'chapter : 'something3',
'position': '4A'
}
]
}
html code:
<template for:each={data.issues} for:item="item" for-index="index">
<h3 class ={dinamicClass} > {index} {item.chaper} </h3>
<h3 claas ={dinamicClass} >{index} {item.position} </h3>
</template>
output:
0 something1 0 2A
1 something2 1 3A
2 something3 3 3A
the idea is to modificate the second row, in bold and bigger.
I try this in JS but doesnt not work
@api index;
get dinamicClass(){
return this.index == 2 ? 'slds_xxxxxxx_large' : slds_xxxxxxx_small'
}
Any idea to can implement to solve this? Thanks
data = {
issues: [
{
'chapter' : 'something1'
'posiion': '2A'
},
{
'chapter': 'something2',
'position' : '3A'
},
{
'chapter : 'something3',
'position': '4A'
}
]
}
html code:
<template for:each={data.issues} for:item="item" for-index="index">
<h3 class ={dinamicClass} > {index} {item.chaper} </h3>
<h3 claas ={dinamicClass} >{index} {item.position} </h3>
</template>
output:
0 something1 0 2A
1 something2 1 3A
2 something3 3 3A
the idea is to modificate the second row, in bold and bigger.
I try this in JS but doesnt not work
@api index;
get dinamicClass(){
return this.index == 2 ? 'slds_xxxxxxx_large' : slds_xxxxxxx_small'
}
Any idea to can implement to solve this? Thanks
Thanks,
Maharajan.C
All Answers
You have to handle this in Javascript... It is better to handle in JS...
Use the below code for your reference:
HTML:
JS:
XML:
Thanks,
Maharajan.C
Thanks,
Maharajan.C