Can someone help me how to make this work please. Wanted to disable the button based on the following criteria //Diabled criteria - MUST be disbaled for all rows except for last row. //Background - we have an ADD button, which once clicked will create an empty row with blank values allowing the user to either manually input or click on "Clone Prev Row values" button to copy previous rows values on to new row.
<template for:each={actualHoursItems} for:item="record" for:index="index">
<tr key={record} data-id={index}>
<td role="gridcell" width="15">
<lightning-input type="text" data-index={index} name="totalHours"
value={record.totalHours} onchange={handleActualHoursUpdate} disabled></lightning-input>
</td>
<td role="gridcell" width="15">
<lightning-button data-index={index} variant="base" label="Clone Prev Row values" disabled={isDisabled}
onclick={handleActualHoursClonePrev} ></lightning-button>
</td>
</tr>
</template>
However, this disabled={index === 0 || actualHoursItems.length != index+1 ? true : false}
is throwing following error & I'm not sure how to resolve it. FYI I wanted to make it work this way with in html instead of using js and passing something like "isdisabled" value.
Invalid HTML syntax: unexpected-equals-sign-before-attribute-name
Invalid HTML syntax: unexpected-character-in-unquoted-attribute-value