I recently installed the 4.6.0 and I can see my data but the data is showing the same for all pages. If I increase the number of rows when I load I see the data fro all those rows but when I go to the next page it is still the same data. Please let me know how to correct the problem that the same data is displaying on all pages.Â
server-update.php :
$page = $_GET[‘page’]; // get the requested page
$limit = $_GET[‘rows’]; // get how many rows we want to have into the grid
$sidx = $_GET[‘sidx’]; // get index row – i.e. user click to sort
$sord = $_GET[‘sord’]; // get the direction
if(!$sidx) $sidx =1; // connect to the database
$db = mysql_connect($dbhost, $dbuser, $dbpass) or die(“Connection Error: ” . mysql_error());
mysql_select_db($database) or die(“Error conecting to db.”);
$result = mysql_query(“SELECT COUNT(*) AS count FROM persons a INNER JOIN addresses b ON b.personID=a.personID WHERE a.isActive=1 “);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row[‘count’];
if( $count >0 ) { $total_pages = ceil($count/$limit);
} else { $total_pages = 0; }
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page – $limit; // do not put $limit*($page – 1)
$SQL = “SELECT * FROM persons a INNER JOIN addresses b ON b.personID=a.personID WHERE 1=1 AND a.isActive=1 ORDER BY $sidx $sord limit $limit”;
$result = mysql_query( $SQL ) or die(“Couldn t execute query. $SQL”.mysql_error());
$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$rowCount=0;
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
…
if ($tmpPersonType==0) $personType = “Related”;
if ($tmpPersonType==1) $personType = “Student”;
if ($tmpPersonType==2) $personType = “Instructor”;
if ($tmpPersonType==3) $personType = “Business”;
$responce->rows[$rowCount][‘id’]=$row[personID];
$responce->rows[$rowCount][‘cell’]=array($row[personID],$personType,$row[firstName],$row[lastName],$row[emailAddress],$tmpPhone,$row[address],$tmpCustom,$tmpRegistrations,$newBalance);
$rowCount++;
…
}
echo json_encode($responce);
[code]
Â
person_search-update.php:
[code]
html, body {
margin: 0; /* Remove body margin/padding */
padding: 0;
overflow: hidden; /* Remove scroll bars on browser window */
font-size: 75%;
}
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
jQuery(document).ready(function(){
var template1 = { "groupOp": "AND", "rules": [ { "field": "a.firstName", "op": "bw", "data": "Client 1" },
{ "field": "a.lastName", "op": "gt", "data": "20"} ] };
jQuery("#person_list").jqGrid({
url:'server-update.php?q=2',
datatype: "json",
colNames:['ID','Type','Last','First','Email','Phone','Address','Custom','Registrations','Balance'],
colModel:[
{name:'id',index:'a.personID', width:20},
{name:'Type', index:'isStudent', sortable:true, width:25},
{name:'Last', index:'a.lastName', width:40},
{name:'First', index:'a.firstName', width:30},
{name:'Email', sortable:true, index:'a.emailAddress', width:60,searchoptions:{sopt:['bw','cn','eq','ne','lt','gt','ew']}},
{name:'Phone', sortable:false,index:'phone', width:35},
{name:'Address', sortable:false,index:'address', width:100},
{name:'Custom', sortable:false,search:false, hidden:false, index:'custom', width:30},
{name:'Registrations', sortable:false,search:false, hidden:false, index:'programCode', width:100},
{name:'Balance', sortable:false,search:false, hidden:false,align:"right", index:'balance', width:40} //CN change 30 to 40
],
rowNum:10,
width:700,
height: '100%',
pager: '#pagerb',
sortname: 'lastName',
rowList:[10,20,50],
viewrecords: true,
sortorder: "asc",
caption: "",
});
jQuery("#person_list").jqGrid('navGrid','#pagerb', {
edit:false,
add:false,
del:false},
{}, {}, {},
{ multipleSearch:true, multipleGroup:false, showQuery: false,
// set the names of the template
"tmplNames" : ["Template One"],
// set the template contents
"tmplFilters": [template1] } );
});
Also how can I get your forum to not dump the formatting when I past my code and save?
Â
Blessings,
Tiffany
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top