Forum
17:05
05/02/2010
I am very new to jquery grid plug in.
My first question is: is this free ? I got confused with licensing, one page shows $299 and the other one when I go to download from the home page, it says it’s free opensource.
I have created same example as showed in the demo. But it doesn’t save data to the table. Am I missing something?
This is my code for displaying
jQuery(document).ready(function(){
var lastsel;
jQuery("#list").jqGrid({
url:'editmembershipdata.php?q=2',
datatype: "json",
colNames:['Id','LastName','FirstName', 'Type', 'PaymentDue','PaymentDate','Email','Phone','Address','City','Zip'],
colModel:[
{name:'id',index:'id', width:55},
{name:'LastName',index:'LastName', width:55},
{name:'FirstName',index:'FirstName', width:90},
{name:'Type',index:'Type', width:100},
{name:'PaymetDue',index:'PaymetDue', width:80, align:"right"},
{name:'PaymetDate',index:'PaymetDate', width:80, editable:true, align:"right" },
{name:'Email',index:'Email', width:80,align:"right"},
{name:'Phone',index:'Phone', width:80,align:"right"},
{name:'Address',index:'Address', width:80,align:"right"},
{name:'City',index:'City', width:80,align:"right"},
{name:'Zip',index:'Zip', width:80,align:"right"},
],
pager: '#pager',
rowNum:20,
autowidth: true,
height:420,
autowidth: true,
sortname: 'LastName, FirstName',
sortorder: 'asc',
viewrecords: true,
onSelectRow: function(id){
if(id && id!==lastsel){
jQuery('#list').jqGrid('restoreRow',lastsel);
jQuery('#list').jqGrid('editRow',id,true);
lastsel=id;
}
},
editurl: "editmembershipdata.php",
caption: "Update Payment"
});
jQuery("#list").jqGrid('navGrid',"#pager",{edit:false,add:false,del:false});
});
This is my Php file for editurl:
<?php
$page = $_GET['page'];
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
if(!$sidx) $sidx =1;
include_once('db.php');
$db = new db();
date_default_timezone_set("US/Eastern");
$sql = "SELECT u.LastName, u.FirstName, mt.Type, ms.PaymentDue, ms.PaymentDate,u.Email, m.Phone, m.Address, m.City, m.Zip,ms.Id
FROM users u
INNER JOIN membershipdetails m ON u.Id = m.UsersId
INNER JOIN membershiptype mt ON m.MembershipTypeId = mt.Id
INNER JOIN membershipstatus ms ON m.Id = ms.MembershipDetailsId
where RenewalYear = '".date("Y"). "'";
$memberships = $db->GetData($sql);
$count = count($memberships);
if( $count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit;
if($start <0) $start = 0;
$SQL = "SELECT u.LastName, u.FirstName, mt.Type, ms.PaymentDue, ms.PaymentDate,u.Email, m.Phone, m.Address, m.City, m.Zip, ms.Id
FROM users u
INNER JOIN membershipdetails m ON u.Id = m.UsersId
INNER JOIN membershiptype mt ON m.MembershipTypeId = mt.Id
INNER JOIN membershipstatus ms ON m.Id = ms.MembershipDetailsId
where RenewalYear = '".date("Y"). "' ORDER BY $sidx $sord LIMIT $start , $limit";
$memberships = $db->GetData($SQL);
$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
for ($i = 0; $i < count($memberships) ; $i++) {
$responce->rows[$i]['id']=$memberships[$i]['Id'];
$responce->rows[$i]['cell']=array($memberships[$i]['Id'],$memberships[$i]['LastName'],$memberships[$i]['FirstName'],$memberships[$i]['Type'],$memberships[$i]['PaymentDue'],$memberships[$i]['PaymentDate'],$memberships[$i]['Email'],$memberships[$i]['Phone'],$memberships[$i]['Address'],$memberships[$i]['City'],$memberships[$i]['Zip']);
}
echo json_encode($responce);
//echo " SQL ".$sql;
?>
14:49
Moderators
30/10/2007
Hello,
About the jqGrid and other products related to it you can read here:
http://www.trirand.com/blog/?p.....mment-7690
About the saving. In the demo there is no script for such purpose for security reasons. You can read this forum how to do this. There are a lot of posts about this.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
47 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