jQuery EasyUI DataGrid autosave

HTML

<h2>DataGrid exsample with autosave</h2>

<p>This sample shows a datagrid and aoutosave ...</p>

<div class="easyui-panel" style="width:100%; height:400px; padding:12px;">
     <table id="dg"></table>
 </div>

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/demo/demo.css">
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> 
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.edatagrid.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-filter.js"></script>
<style>

JavaScript

$(function(){
    var dg = $('#dg').edatagrid();
    
    dg.edatagrid({
		title:"Test DataGrid",
        fit:true,
		pagination: true,
        singleSelect:true,
    	striped:true,
	    rownumbers: true,
	    fitColumns: true,

        data:data,

		columns:[[
        {field:'f1',title:'title1',width:100,editor:'text'},
        {field:'f2',title:'title2',width:100,editor:'text'},
        {field:'f3',title:'title3',width:100,editor:'text'},
        {field:'f4',title:'NotSave',width:50,
             editor:{type:'checkbox',options:{on:1,off:0}}}
      	]],

        autoSave: true,
        onBeforeSave: function(index){
            var ed = $(this).edatagrid('getEditor',{index:index,field:'f4'});
            if ((ed.target).is(':checked')){
                //use the alert and a loop is called when autoSave is active!!!
                $.messager.alert('error', 'message cannot save why ....' , "warning");
                return false;
            }
        }        
        
	});
});

var data = [
    {f1:'v11',f2:'v12',f3:'v13'},
    {f1:'v21',f2:'v22',f3:'v23'},
    {f1:'v31',f2:'v32',f3:'v33'},
    {f1:'v41',f2:'v42',f3:'v43'}
];