i want a condition if at least 1 is selected all buttons must be disabled <td…
- User
i want a condition if at least 1 is selected all buttons must be disabled
- Assistant
You can add a condition in your code to check if at least one button is selected, and if so, disable all buttons. Here is an example of how you can modify your code to achieve this:
<td class="w-custom-10% rounded-none text-center"> <button [ngStyle]="{ opacity: country.selected ? '0.5' : '1' }" [disabled]="country.selected || isAnyButtonSelected()" (click)="openModal(2, country)" type="button" class="bg-custom-gray text-custom-blue border-none w-custom-w-60px h-custom-h-30px mr-1 hover:bg-custom-gray focus:bg-custom-gray rounded" > <i class="material-icons align-top">edit</i> </button> <button [ngStyle]="{ opacity: country.selected ? '0.5' : '1' }" [disabled]="country.selected || isAnyButtonSelected()" (click)="openConfirmationDialogBox(3, country)" type="button" class="bg-custom-red-del text-custom-white border-none w-custom-w-60px h-custom-h-30px hover:bg-custom-red-del focus:bg-custom-red-del rounded" > <i class="material-icons align-top">delete_forever</i> </button> </td>
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.