Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
getting saveRow to work
Tags: SaveRow
23/09/2010
11:12
Avatar
satyajivanam
New Member
Members
Forum Posts: 1
Member Since:
23/09/2010
sp_UserOfflineSmall Offline

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

23/09/2010
14:51
Avatar
bogoa666
Malaga (Spain)
Member
Members
Forum Posts: 21
Member Since:
23/09/2010
sp_UserOfflineSmall Offline

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.
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
24 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information