jQuery EasyUI DataGrid autosave
HTML
<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> <style>
JavaScript
$(function () {
var dg = $('#dg').edatagrid();
dg.edatagrid({
title: "Test edatagrid",
fit: true,
pagination: true,
singleSelect: true,
striped: true,
rownumbers: true,
fitColumns: true,
data: data,
updateUrl: '/echo/json/',
columns: [
[{
field: 'brand_id',
title: 'Company',
width: 100,
editor: 'text',
formatter: function(value,row,index){
return row.brand_name;
},
editor:{
type:'combobox',
options:{
valueField:'brand_id',
textField:'brand_name',
data: data2,
panelHeight:90,
required:true,
//onSelect:onSelectCombobox
}
}
}, {
field: 'date',
title: 'Date',
sortable: true,
width: 60,
editor: {
type: 'datebox',
options: {
required: false,
panelWidth: '270',
editable: false
}
}
}]
],
onEndEdit: function(index,row){
var ed = $(this).edatagrid('getEditor',{index:index,field:'brand_id'});
var cc = $(ed.target);
$.extend(row, {
brand_id: cc.combobox('getValue'),
brand_name: cc.combobox('getText')
});
}
});
});
var data = [{
brand_id: 'v11',
brand_name: 'Marvell Semiconductor',
date: '03/16/2015',
cbx: 'true'
}, {
brand_id: 'v21',
brand_name: 'Kennedy Enterprise',
date: null,
cbx: true
}, {
brand_id: 'v41',
brand_name: 'Versatile Inc.',
date: null,
cbx: false
}];
var data2 = [{
brand_id: 'v11',
brand_name: 'Marvell Semiconductor',
date: '03/16/2015',
cbx:...