If the data source has a Boolean value, then the most appropriate control in the UI is the checkBox.

EasyUI datagrid column checkbox set:

{field:'status'.title:'Status'.width:50.align:'center'.editor: {type:'checkbox'.options: {on: "true".off: "false"}}},Copy the code

Data:

{"total":28."rows":[
	{"productid":"FI-SW-01"."unitcost":10.00."status":true."listprice":16.50."attr1":"Large"."itemid":"EST-1"},
	{"productid":"K9-DL-01"."unitcost":12.00."status":true."listprice":18.50."attr1":"Spotted Adult Female"."itemid":"EST-10"},
	{"productid":"RP-SN-01"."unitcost":12.00."status":true."listprice":18.50."attr1":"Venomless"."itemid":"EST-11"}}]Copy the code


\

Here’s the problem:

When rows in the datagrid are edited, the checkbox does not automatically carry the value they should have, such as true, but is not automatically checked when checkbox appears. Check the checkbox (true) and return the checkbox to false. What’s wrong with you?

“Status “:true ==> “status”:”true”

{"total":28."rows":[
	{"productid":"FI-SW-01"."unitcost":10.00."status":"true"."listprice":16.50."attr1":"Large"."itemid":"EST-1"},
	{"productid":"K9-DL-01"."unitcost":12.00."status":"true"."listprice":18.50."attr1":"Spotted Adult Female"."itemid":"EST-10"},
	{"productid":"RP-SN-01"."unitcost":12.00."status":"true"."listprice":18.50."attr1":"Venomless"."itemid":"EST-11"}}]Copy the code

It’s not clear why. Maybe in a checkbox, the value is a character. Although it is often used to render booleans, it does not recognize any Booleans.


\