JSFiddle - React, Tailwind, and code Playground
HTML
<table id="pg"><table>
CSS
</style>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/color.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<style>
JavaScript
var data = {"total":7,"rows":[
{"name":"Name","value":"Bill Smith","group":"ID Settings","editor":"text"},
{"name":"Address","value":"","group":"ID Settings","editor":"text"},
{"name":"Age","value":"40","group":"ID Settings","editor":"numberbox"},
{"name":"Birthday","value":"01/02/2012","group":"ID Settings","editor":"datebox"},
{"name":"SSN","value":"123-456-7890","group":"ID Settings","editor":"text"},
{"name":"Email","value":"bill@gmail.com","group":"Marketing Settings","editor":{
"type":"validatebox",
"options":{
"validType":"email"
}
}},
{"name":"FrequentBuyer","value":"false","group":"Marketing Settings","editor":{
"type":"checkbox",
"options":{
"on":true,
"off":false
}
}}
]};
$('#pg').propertygrid({
width: 400,
data: data,
scrollbarSize: 0,
columns:[[
{field:'name',title:'Name',width:100,sortable:true},
{field:'value',title:'Value',width:100,resizable:false,
formatter:function(value,row){
if (row.name == 'FrequentBuyer'){
console.log(value)
return '<input class="pg-ck" type="checkbox" ' + (value=='true'?'checked':'') + '>' + value;
} else {
return value;
}
}
}
]],
onBeforeEdit: function(index,row){
if (row.name == 'FrequentBuyer'){
return false;
}
},
onLoadSuccess: function(){
var pg = $(this);
$(this).propertygrid('getPanel').click(function(e){
if ($(e.target).hasClass('pg-ck')){
var tr = $(e.target).closest('tr.datagrid-row');
var index = parseInt(tr.attr('datagrid-row-index'));
var row = pg.propertygrid('getRows')[index];
if (row.value == 'true'){
row.value = 'false';
} else {
row.value = 'true';
}
pg.propertygrid('refreshRow', index);
}
})
}
})