PDA

View Full Version : problem with paging



nibblas
21 Oct 2010, 7:38 AM
hy to all

i have problems with my paging.
start and limit parameter where correct passed to php file.

but if i page forward, the limit parameter won't raise....

have a look at my screeny

my store

var store = new Ext.data.JsonStore({
proxy :proxyFirmenGrid,
fields :fieldsFirmenGrid,
root :'results',
autoLoad : true,
baseParams :{
task: 'LISTING'
},
idProperty: 'ID'
});my paging bar

bbar: new Ext.PagingToolbar({
pageSize: 3,
store: store,
displayInfo: true
}),
php file

function getList(){
$query = "SELECT *FROM B_Firma";

if (isset($_POST['query'])){
$query .= " WHERE(Firma LIKE '%".addslashes($_POST['query'])."%' OR Aktiv LIKE '%".addslashes($_POST['query'])."%')";
}

$result = mssql_query($query);
$nbrows = mssql_num_rows($result);

$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);
$ende = (integer) $_POST['limit'];

$query = "SELECT *
FROM (SELECT ROW_NUMBER() OVER(ORDER BY Firma ASC) AS
rownum, Firma, Aktiv,CreationDate FROM B_Firma) AS Firmen
WHERE rownum BETWEEN ".$start." AND ".$ende."
ORDER BY rownum ASC";
$result = mssql_query($query);


if($nbrows>0){
while($rec = mssql_fetch_assoc($result)){
$arr[] = $rec;

}
$jsonresult = JEncode($arr);
//$jsonresult = $json->encode($arr);
echo '({"total":"'.$nbrows.'","results":'.$jsonresult.'})';
} else {
echo '({"total":"0", "results":""})';
}

}the paging bar should raise the limit and start by every click on next page?!?

any idea's

cheers

Keylan
21 Oct 2010, 5:05 PM
Limit will stay the same, set by pageSize. Start should raise or lower by pageSize when you change the page. Since I see start is 3 in the screen shot, and it probably started at 0 - it seems that it is indeed changing?

nibblas
22 Oct 2010, 1:39 AM
sure, my mistake... because i'm using mssql the limit statement ist not available...
i've added the logic to my php file (raised $end with $start) now it's working...

thanx anyway!

cheeers