Checkbox with string values instead of boolean?

UI Components for Angular
Post Reply
tomm0
Posts: 6
Joined: 25 Oct 2017, 17:43

18 Nov 2017, 05:01

Hello. I am in the process of porting a Java application to the browser using Angular and PrimeNG. The hope is to not change the back-end while rewriting the front end. All of our checkbox fields are stored in the database as either "Y" or "N" instead of true or false. The Rest API expects to receive them as Y or N as well.

I think it makes sense to still use the checkbox in binary mode, however the goal is to have Checkbox selected if the model value = "Y" and unselected if the model value = "N". I'd rather not have to maintain both a boolean and string value for each checkbox. Is there a more seamless way to handle this?

Thanks

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4295
Joined: 16 Oct 2011, 19:19
Location: Singapore

19 Nov 2017, 14:04

The binary checkbox will be done with boolean type only. So you need to maintain both types of variables.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

Post Reply
  • Information
  • Who is online

    Users browsing this forum: asmodis and 6 guests