JSON and booleans

I am using jqgrid (jquery plugin) and using json format to return the results from the server side. I have yes or no values ​​from the database. But when displayed, jqgrid displays them as “true” or “false”. How to save values ​​as "Yes" or "No"?

thank

+3
source share
2 answers

You do not include the definition of the jqGrid column having the problem, nor any JSON test data. So I'm trying to tip over. I believe that you save the information in the database as logical and send the values ​​"true" and "false" inside the JSON data. If you do not use any formatter, the data will be displayed as text. To display the data as other text, you can use the 'select' formatter :

formatter:'select', stype:'select', edittype:'select',
editoptions: { value: "false:No;true:Yes" }
+6
source

If it comes to display options, you can use the checkbox and EditOptions for this field in jqGrid.

editoptions: { value:"Yes:No" }

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules

+2
source

Source: https://habr.com/ru/post/1785195/


All Articles