Hi,
I'm newbie in this forum.
Can't to find info, how to do remote grid with virtual scrolling ( don't showing pager ).
Here it's mine sources :
<script class="ppjs">
$( function ()
{
var wdt = $( window ).width() - 20;
var hgt = $( window ).height() - 20;
var colM =
[
{ title: "Opr.NR", width: 100, dataIndx: "op_nr" },
{ title: "Pavadinimas liet.", width: 200, dataIndx: "pav_lt" },
...
];
var dataModel = {
location: "remote",
dataType: "JSON",
method : "GET",
url : "opr_rem.php",
getData : function( dataJSON )
{
return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };
}
}
var grid1 = $( "div#grid_php" ).pqGrid(
{
width : wdt,
height : hgt,
dataModel : dataModel,
colModel : colM,
freezeCols : 1,
pageModel : { type: "remote", rPP: 500, strRpp: "{0}" },
sortable : false,
wrap : false, hwrap: false,
resizable : false,
scrollModel: { autoFit: true }
});
Php file :
require_once '../conf.php';
$dbh = getDatabaseHandle();
$cpg = $_REQUEST[ "pq_curpage" ];
$rpp = $_REQUEST[ "pq_rpp" ];
$sql = "Select count(*) from opr";
$dsn = 'mysql:host='.DB_HOSTNAME.';dbname='.DB_NAME;
$optn = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', );
$dbh = new PDO( $dsn, DB_USERNAME, DB_PASSWORD, $optn );
$stmt = $dbh->query( $sql );
$totRec = $stmt->fetchColumn();
$skip = ( $rpp * ( $cpg - 1 ) );
if ( $skip >= $totRec )
{
$cpg = ceil( $totRec / $rpp );
$skip = ( $rpp * ( $cpg - 1 ) );
}
$sql = "select op_nr, pav_lt ... from opr limit " . $skip . " , " . $rpp;
$stmt = $dbh->query( $sql );
$rows = $stmt->fetchAll( PDO::FETCH_ASSOC );
$sb = "{ \"totalRecords\":" . $totRec . ",\"curPage\":" . $cpg . ",\"data\":" . json_encode( $rows ) . "}";
echo $sb;
Grid is working fine, but with pager. How to do it without pager ? Or hide pager ?
Thanks in advance !