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_TopicIcon
How to save data from a grid
05/02/2010
17:05
Avatar
vzm5jt
New Member
Members
Forum Posts: 2
Member Since:
05/02/2010
sp_UserOfflineSmall Offline

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;

?>

10/02/2010
14:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
19 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