franzisk
11 May 2007, 4:12 AM
I still didnt figure out how this pagging stuf works.
Could anybody give me (in a few words) a tip how to proceed to do pagging?
Example:
I have a table (in MySQL accessed with PHP) with 70.000 lines (records), I want to show pages in a grid with 25 lines per page.
What I have until now:
acion.php
$start = $_POST['start'];
$limit = $_POST['limit'];
$searchId = $_POST['searchId'];
$sql = 'SELECT
accountID id,
screenName username,
headline title,
profile_Writeup body,
dLastLogon login,
topMember topmember
FROM
`MemberProfile`
LIMIT '.$start.', '.$limit.';';
...
$json = new Services_JSON();
$output = $json->encode($search);
print("{totalCount:\"".count($search)."\", data:".$output."}");
Part of my Grid code:
var GridUI = function() {
var ds; //hold our data
var grid; //component
var columnModel; // definition of the columns
var dialog;
function setupDataSource() {
ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy ({url:'action.php'}),
reader: new Ext.data.JsonReader(
{root:'data', id: 'id', totalProperty: 'totalCount'},
[
{name: 'id', type: 'int'},
{name: 'username'},
{name: 'title', align: 'center'},
{name: 'photo', align: 'center'},
{name: 'login', type: 'date', dateFormat: 'Y-m-d H:i:s'},
{name: 'topmember', type: 'boolean'}
]
)
});
ds.load({params:{start:0, limit:25, searchId:1}});
}
...
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 25,
displayInfo: true,
displayMsg: 'Showing profile {0} - {1} of {2}',
emptyMsg: "No profiles to show"
});
}
...
What can I do to have the correct total of records and what can I do to go to the next set of 25 records?
Still (for who uses php), is there any way to get ISO-8859-1 characters correctly with json->encode ?
Thanks in advance
Could anybody give me (in a few words) a tip how to proceed to do pagging?
Example:
I have a table (in MySQL accessed with PHP) with 70.000 lines (records), I want to show pages in a grid with 25 lines per page.
What I have until now:
acion.php
$start = $_POST['start'];
$limit = $_POST['limit'];
$searchId = $_POST['searchId'];
$sql = 'SELECT
accountID id,
screenName username,
headline title,
profile_Writeup body,
dLastLogon login,
topMember topmember
FROM
`MemberProfile`
LIMIT '.$start.', '.$limit.';';
...
$json = new Services_JSON();
$output = $json->encode($search);
print("{totalCount:\"".count($search)."\", data:".$output."}");
Part of my Grid code:
var GridUI = function() {
var ds; //hold our data
var grid; //component
var columnModel; // definition of the columns
var dialog;
function setupDataSource() {
ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy ({url:'action.php'}),
reader: new Ext.data.JsonReader(
{root:'data', id: 'id', totalProperty: 'totalCount'},
[
{name: 'id', type: 'int'},
{name: 'username'},
{name: 'title', align: 'center'},
{name: 'photo', align: 'center'},
{name: 'login', type: 'date', dateFormat: 'Y-m-d H:i:s'},
{name: 'topmember', type: 'boolean'}
]
)
});
ds.load({params:{start:0, limit:25, searchId:1}});
}
...
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 25,
displayInfo: true,
displayMsg: 'Showing profile {0} - {1} of {2}',
emptyMsg: "No profiles to show"
});
}
...
What can I do to have the correct total of records and what can I do to go to the next set of 25 records?
Still (for who uses php), is there any way to get ISO-8859-1 characters correctly with json->encode ?
Thanks in advance