Home › Forums › Guriddo jqGrid JS › Help › save row
Hi,
i’m a new user and i have a problem: the script works well but when i try to save the edited row (pressing enter) it does not save and goes to the next page…..
any suggestion?
thanks a lot
Please upgrage to 3.2. This bug is corrected. Actually this is only in IE.
Regards
Tony
Hi Tony,
i downloaded 3.2rc and copied the 5 files in js dir.
nothing has changed….
any idea?
thanks for the excellent work…..
after a few, the problem is that the script does not save on the db.
if i use only the mouse to edit (non “enter” at all) the row display the correct modified data.
but if i reload the page, the modified data is lost, it doesn’t save on the DB….
here my script:
var lastsel;
jQuery(“#rowed3”).jqGrid({
url:’elenco_aziende_jgrid_evento.php?q=2&nd=’+new Date().getTime(),
datatype: “json”,
//colNames:,
colNames:,
height: 490,
colModel:[
{name:’id’,index:’id’, width:20},
{name:’azienda’,index:’azienda’, width:180, editable:true},
{name:’indirizzo’,index:’indirizzo’, width:180, editable:true},
{name:’localita’,index:’localita’, width:130, editable:true},
{name:’tel1′,index:’tel1′, width:64, sortable:false, editable:true},
{name:’fax’,index:’fax’, width:64, sortable:false, editable:true},
{name:’mail’,index:’mail’, width:110, sortable:false, editable:true},
{name:’contatto1′,index:’contatto1′, width:80, sortable:false, editable:true},
{name:’data’,index:’data’, width:64, editable:true},
{name:’modifica’,index:’modifica’, width:64, editable:true}
],
rowNum:24,
rowList:[10,20,30],
imgpath: ‘themes/power/images’,
pager: jQuery(‘#prowed3’),
sortname: ‘azienda’,
viewrecords: true,
sortorder: “asc”,
onSelectRow: function(id){
if(id && id!==lastsel){
//jQuery(‘#rowed3’).restoreRow(lastsel);
jQuery(‘#rowed3’).saveRow(id);
jQuery(‘#rowed3’).editRow(id,true);
lastsel=id;
}
},
editurl: “elenco_aziende_jgrid_evento.php”
});
and PHP:
0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
if($start page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$i=0;
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$responce->rows[$i]=$row[id];
$responce->rows[$i]=array($row[id],$row[azienda],$row[indirizzo],$row[localita],$row[tel1],$row[fax],$row[mail],$row[contatto1],$row[data],$row[modifica]);
$i++;
}
echo $json->encode($responce);
?>
thanks a lot
the PHP script:
= 5 this file is not needed
include(“JSON.php”);
// create a JSON service
$json = new Services_JSON();
// to the url parameter are added 4 parameter
// we shuld get these parameter to construct the needed query
// for the pager
// get the requested page
$page = $_REQUEST;
// get how many rows we want to have into the grid
// rowNum parameter in the grid
$limit = $_REQUEST;
// get index row – i.e. user click to sort
// at first time sortname parameter – after that the index from colModel
$sidx = $_REQUEST;
// sorting order – at first time sortorder
$sord = $_REQUEST;
// if we not pass at first time index use the first column for the index
if(!$sidx) $sidx =1;
// connect to the MySQL database server
$db = mysql_connect($dbhost, $dbuser, $dbpassword)
or die(“Connection Error: ” . mysql_error());
// select the database
mysql_select_db($database) or die(“Error conecting to db.”);
// calculate the number of rows for the query. We need this to paging the result
$result = mysql_query(“SELECT COUNT(*) AS count FROM anagrafica_azienda”);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row;
//$count = mysql_numrows($result);
// calculation of total pages for the query
if( $count >0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
// if for some reasons the requested page is greater than the total
// set the requested page to total page
if ($page > $total_pages) $page=$total_pages;
// calculate the starting position of the rows
$start = $limit*$page – $limit; // do not put $limit*($page – 1)
// if for some reasons start position is negative set it to 0
// typical case is that the user type 0 for the requested page
if($start page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$i=0;
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$responce->rows[$i]=$row[id];
$responce->rows[$i]=array($row[id],$row[azienda],$row[indirizzo],$row[localita],$row[tel1],$row[fax],$row[mail],$row[contatto1],$row[data],$row[modifica]);
$i++;
}
// return the formated data
echo $json->encode($responce);
?>
Open jquery.jqGrid.js and see which .js files are you use. Maybe you use minified files. Change the paths to right files.
Regards
Tony
in jquery.jqGrid.js:
var modules = [
{ include: true, incfile:’grid.base.js’,minfile: ‘min/grid.base-min.js’}, // jqGrid base
{ include: true, incfile:’grid.formedit.js’,minfile: ‘min/grid.formedit-min.js’ }, // jqGrid Form editing
{ include: true, incfile:’grid.inlinedit.js’,minfile: ‘min/grid.inlinedit-min.js’ }, // jqGrid inline editing
{ include: true, incfile:’grid.subgrid.js’,minfile: ‘min/grid.subgrid-min.js’}, //jqGrid subgrid
{ include: true, incfile:’grid.postext.js’,minfile: ‘min/grid.postext-min.js’} //jqGrid post extension
];
now, what i have to do?
thanks a lot for your patience….
Not this, but this
var minver = true;
Set it to false to use the new version
Regards
Tony
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top