Hi Sworthy,
may I ask you to verify if this is a bug or my error ?
I have modified the example with edatagrid found here:
http://www.jeasyui.com/extension/edatagrid.phpThe only modification is in order to work with a database and not a json-file.
To this purpose I have added saveUrl and updateUrl (see code below).
The problem:
If I add a new row, "saveUrl" is fired. This is ok.
But if the next action is to modify the last added record, "saveUrl" is fired again (instead of "updateUrl").
If I modify another record (not the last) all is ok.
Thanks a lot if you can confirm this.
Regards
Miche
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="easyui.css">
<link rel="stylesheet" type="text/css" href="icon.css">
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="jquery.easyui.min.js"></script>
<script type="text/javascript" src="jquery.edatagrid.js"></script>
<script type="text/javascript">
$(function(){
$('#tt').edatagrid({
idField: 'itemid',
url: 'db.cgi?action=List',
saveUrl: 'db.cgi?action=Save',
updateUrl: 'db.cgi?action=Update'
});
});
</script>
</head>
<body>
<h1>Editable DataGrid</h1>
<div style="margin-bottom:10px">
<a href="#" onclick="javascript:$('#tt').edatagrid('addRow')">AddRow</a>
<a href="#" onclick="javascript:$('#tt').edatagrid('saveRow')">SaveRow</a>
<a href="#" onclick="javascript:$('#tt').edatagrid('cancelRow')">CancelRow</a>
<a href="#" onclick="javascript:$('#tt').edatagrid('destroyRow')">destroyRow</a>
</div>
<table id="tt" style="width:600px;height:200px"
title="Editable DataGrid",
singleSelect="true">
<thead>
<tr>
<th field="itemid" width="100" editor="{type:'validatebox',options:{required:true}}">Item ID</th>
<th field="productid" width="100" editor="text">Product ID</th>
<th field="listprice" width="100" align="right" editor="{type:'numberbox',options:{precision:1}}">List Price</th>
<th field="unitcost" width="100" align="right" editor="numberbox">Unit Cost</th>
<th field="attr1" width="150" editor="text">Attribute</th>
</tr>
</thead>
</table>
</body>
</html>