function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ragnar Lothbrok 7Ragnar Lothbrok 7 

How to set the value of lightning-combobox of list of object in LWC?

Hi,
I have a Lwc component there i am showing the list of fields with 3 rows, for that row we have values in it and that value is comming from this code :
getPickListValues({
            objApiName: 'OpportunityContactRole',
            fieldName: 'Role'
            })
            .then(data => {
                //console.log('OUTPUT : Picklist data :',data);
                for (let index = 0; index < data.length; index++) {
                    if(data[index].label=='L3' || data[index].label=='L4' || data[index].label=='L5'){
                        this.temp.push(data[index]);
                    }                    
                }
                this.options = this.temp;
                console.log('OUTPUT : TempData',this.options);
            })
            .catch(error => {
                console.log('OUTPUT Error: ',error);
            });

And the Html code is :
<template for:each={contactList} for:item="contact" for:index="index">
                <tr key={contact.Id}>
                    <td>
                        <!--<lightning-formatted-text data-index={index} value= {contact.role}></lightning-formatted-text>-->
                        <div class="slds-var-m-bottom_medium slds-var-p-right_medium">
                            <template if:true={options}>
                                <lightning-combobox data-index={index} class="myCombobox"  placeholder={label.Contact_Role_Placeholder} name="Role" value= {contact.role}                   
                                    options={options} onchange={onRoleChange} >
                                </lightning-combobox>
                            </template>
                            <!--<p>Selected value is: {contact.role}</p>-->
                        </div>
                    </td>
                <td>
<template>

And the UI is here :
User-added image
I wanted to have the default value for each row. On pageLoad directly, I tried but unable to do that, please guide me how to achieve that.
Thanks