Forum



11:12

23/09/2010

Hi,
I am trying to get the daveRow functionality working.
I have the editurl set to saveData.php and I'm assuming that when I call saveRow that should POST data to the php script.
At the momement, saveData.php only contains code to write a file to the server, I wanted to see if it was being called via jgrid, but it does not seem to be.
Here is the javascript...can anyone help..?
<script type="text/javascript">
var lastsel;
$(function(){
$("#list").jqGrid({
url:'example.php',
datatype: 'xml',
mtype: 'GET',
colNames:['Inv No','Date', 'Amount','Tax','Total','Notes'],
colModel :[
{name:'id', index:'id', width:55},
{name:'invdate', index:'invdate', width:90,editable:true},
{name:'amount', index:'amount', width:80, align:'right',editable:true},
{name:'tax', index:'tax', width:80, align:'right',editable:true},
{name:'total', index:'total', width:80, align:'right',editable:true},
{name:'note', index:'note', width:150, sortable:false,editable:true}
],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
sortname: 'amount',
sortorder: 'desc',
viewrecords: true,
caption: '',
editurl: "saveData.php",
onSelectRow: function(id){
if(id && id!==lastsel){
jQuery('#list').jqGrid('restoreRow',lastsel);
jQuery('#list').jqGrid('saveRow',id);
jQuery('#list').jqGrid('editRow',id,true);
lastsel=id;
}
}
});
});
</script>
thank you
14:51

23/09/2010

try with this:
view:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'example.php',
datatype: 'xml',
mtype: 'POST',
colNames:['Inv No','Date', 'Amount','Tax','Total','Notes'],
colModel :[
{name:'id', index:'id', width:55},
{name:'invdate', index:'invdate', width:90,editable:true},
{name:'amount', index:'amount', width:80, align:'right',editable:true},
{name:'tax', index:'tax', width:80, align:'right',editable:true},
{name:'total', index:'total', width:80, align:'right',editable:true},
{name:'note', index:'note', width:150, sortable:false,editable:true}
],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
sortname: 'amount',
sortorder: 'desc',
viewrecords: true,
caption: '',
editurl: "saveData.php"
});
jQuery("#list").jqGrid('navGrid','#pager', {del:false,add:true,edit:false,search:false});
});
</script>
<table id="list"></table>
<div id="pager"></div>
saveData.php
<?
print_r($_POST);
?>
Then, you must view the post data when add a new row by default. Lately, you can write you own add button.
Most Users Ever Online: 715
Currently Online:
69 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66