70
Views
6
Comments
Solved
In a list widge the checkbox is only selected one
Question
Application Type
Reactive

When I insert a checkbox in a list widget, but if it is selected, all checkbox will be selected at the same time, and all be canceled at the same time 


But I only want to select one.


How to do it 

(I so sorry my English )

Test.oml
2024-01-04 15-15-51
Abed Al Banna
Solution

Hi @Hora susuki 

That's because you are using the same variable "BooleanVar" for all the list checkboxes.

Once you check/uncheck any Checkbox, it toggles the value of this boolean between True and False.

One solution would be to add one additional attribute to your entity of Boolean type:


Then set the value of the Checkbox in each list item to "GetTests.List.Current.Test.IsChecked":

I will attach the updated OML, I hope this helps!

Best regards,

Abed

Test.oml
UserImage.jpg
Hora susuki

Hi @Abed Al Banna 

Thanks very much 


2024-01-04 15-15-51
Abed Al Banna

If this solved your issue please mark this as a solution and proceed to close this thread, for it not to remain under the "Unsolved" tab.

2023-11-07 18-53-22
José Rodrigues
Solution

I have built you a sample example so you can check it out. I created an additional screen (screen 3) in your app where you can see it working.



Best regards,
José Rodrigues

Test_updated.oml
2024-01-04 15-15-51
Abed Al Banna
Solution

Hi @Hora susuki 

That's because you are using the same variable "BooleanVar" for all the list checkboxes.

Once you check/uncheck any Checkbox, it toggles the value of this boolean between True and False.

One solution would be to add one additional attribute to your entity of Boolean type:


Then set the value of the Checkbox in each list item to "GetTests.List.Current.Test.IsChecked":

I will attach the updated OML, I hope this helps!

Best regards,

Abed

Test.oml
UserImage.jpg
Hora susuki

Hi @Abed Al Banna 

Thanks very much 


2024-01-04 15-15-51
Abed Al Banna

If this solved your issue please mark this as a solution and proceed to close this thread, for it not to remain under the "Unsolved" tab.

2023-11-07 18-53-22
José Rodrigues

Hey @Hora susuki
 
- You are having that problem because you are using the same local variable to control all checkboxes so either they will be all selected or all not selected.

- In order to do what you want you need to add an additional attribute to your aggregate that has a Boolean value for each checkbox of each row.

- Then you need to create a client action to be the handler of the On Change event of your check box if you want to add some additional logic.

2023-11-07 18-53-22
José Rodrigues
Solution

I have built you a sample example so you can check it out. I created an additional screen (screen 3) in your app where you can see it working.



Best regards,
José Rodrigues

Test_updated.oml
UserImage.jpg
Hora susuki

You are right 

I know how to do it

Thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.