You have to extend the 'switchbutton' editor before using it.
<script>
$.extend($.fn.datagrid.defaults.editors, {
switchbutton:{
init:function(container,options){
var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container);
return input.switchbutton(options);
},
getValue:function(target){
return $(target).switchbutton('options').checked;
},
setValue:function(target,value){
if (value){
$(target).switchbutton('check');
} else {
$(target).switchbutton('uncheck');
}
},
resize: function(target, width){
$(target).switchbutton('resize', {width:width});
}
}
});
</script>
Usage example:
{"name":"FrequentBuyer","value":false,"group":"Marketing Settings","editor":{
"type":"switchbutton",
"options":{
}
}}