Moment For Technology

EasyUI checkbox editor

Posted on Oct. 11, 2023, 1:03 p.m. by Callum Hussain
Category: The back-end Tag: The back-end

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.



\

Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.