Title: edatagrid updateUrl not working
Post by: tooletime on June 01, 2016, 08:48:18 AM
I have a very simple table with the following as the dg. I can click in the cell to edit but when i click out of cell nothing happens. when i refresh table it goes back to original data. var bltype = [ {id:'1',name:'Baseline'}, {id:'2',name:'IAVA'}, {id:'3',name:'Other'} ];
$(function(){ $('#dg').edatagrid({ url: 'get_baselinedata.php', saveUrl: 'baseline_save.php', updateUrl: 'baseline_update.php', destroyUrl: 'baseline_destroy.php', autoSave: true, width: '660px', height: '475px', halign: 'right' }); }); </script>
<div id="toolbar"> <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:$('#dg').edatagrid('addRow',{index:0})">New</a> <!-- <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyItem()">Destroy</a>--> <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:$('#dg').edatagrid('destroyRow')">Destroy</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="javascript:$('#dg').edatagrid('saveRow')">Save</a> <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="javascript:$('#dg').edatagrid('cancelRow')">Cancel</a> <!-- <input id="tbsearch" class="easyui-searchbox" data-options="autocomplete:'on',prompt:'Please Input Value',searcher:doSearch" alighn="right" style="width:300px"/>--> </div> <table id="dg" singleSelect="true" align="center" idField="ID" toolbar="#toolbar"> <thead> <tr> <th data-options="field:'ID',width:55,sortable:true">ID</th> <th data-options="field:'baseline',width:200,align:'left',required:true, editor:'textbox'">Baseline</th> <th data-options="field:'baselinetype',width:100,editor: {type:'combobox', options: {valueField:'name', textField:'name', data:bltype, required:true } }">Baseline Type</th> <th data-options="field:'del_date',width:90,align:'center',editor:{type:'datebox'}">Delivered Date</th> <th data-options="field:'location',width:80,align:'center',editor:'textbox'">Location</th> </tr> </thead> </table> </div>
baselineupdate.php
<?php ini_set('display_errors', 'On'); error_reporting(E_ALL);
$ID = intval($_REQUEST['ID']); $baseline = $_REQUEST['baseline']; $baselinetype = $_REQUEST['baselinetype']; $del_date = $_REQUEST['del_date']; $location = $_REQUEST['location'];
include 'cmlibraryconn.php';
$sql="update delivered set baseline='$baseline', baselinetype='$baselinetype',del_date='$del_date', location='$location' where ID=$ID";
@mysql_query($sql); echo json_encode(array( 'ID' => $ID, 'baseline' => $baseline, 'baselinetype' => $baselinetype, 'del_date' => $del_date, 'location' => $location )); ?>
Title: Re: edatagrid updateUrl not working
Post by: jarry on June 01, 2016, 03:47:24 PM
Please look at this example http://www.jeasyui.com/tutorial/app/crud2.php
|