You need to sign in to do that
Don't have an account?
Eric-aeje
lwc how to display count of items in for each from Apex class
Hi I'm looking to find the number of items in a lighting web components for each loop from an apex class?
// html
<template for:each={caselist.data} for:item="c" for:index="index">
<div class="ca-table-row cc_table_row" key={c.Id}>
{c.name}
</div>
</template>
// JS
</div>
import { LightningElement, api, wire, track } from 'lwc';
import retrieveCases from '@salesforce/apex/Controller.getCaselist';
export default class lightningComp extends LightningElement {
@wire(retrieveCases)
caselist;
// find how many items are in caselist for each loop
}
Try the below code:
HTML:
JS:
Thanks,
Maharajan.C
All Answers
Try the below code:
HTML:
JS:
Thanks,
Maharajan.C