Hi,
I am using pageable results to populate a dataset that is bound to a datagrid. I followed the example on amfphp.org and have been able to successful populate my datagrid with the first page of results. However, when I scroll down in my datagrid the next page of results doesn't appear, just empty spaces where they should appear. My NetConnection debugger is showing that the next 3 pages of results are successfully called/returned, so I don't know why they aren't appearing in the datagrid. Maybe I am missing something. Any suggestions appreciated....
Here is my code:
Flash:
Code:
function getSummary() {
var pc:PendingCall = service.getSummary();
pc.responder = new RelayResponder(this, "handleGetSummary", "handleRemotingError");
}
Code:
function handleGetSummary(re:ResultEvent) {
re.result.setDeliveryMode("page", 10, 0);
ds_gems.dataProvider = re.result;
grid.dataProvider = ds_gems.dataProvider;
var src = new mx.data.binding.EndPoint();
var dest = new mx.data.binding.EndPoint();
src.component = dataSet;
src.property = "dataProvider";
src.event = "modelChanged";
dest.component = dataGrid;
dest.property = "dataProvider";
dest.event = "modelChanged";
new Binding(src, dest,undefined,true);
grid.removeAllColumns();
grid.columnNames = ["Id","Title","Category","Created"];
}
getSummary();
PHP:
PHP Code:
....
var $countQuery; //used for paging results
PHP Code:
"getSummary" => array(
"description" => "gets a summary of most relevant gem info", "access" => "remote",
"returntype" => "recordset",
"pagesize" => "10"
)
PHP Code:
function getSummary($offset=0, $limit=10) {
$query = "SELECT pm.pod_id as 'Id', pc.pod_title as 'Title', ps.pod_subcat_name as 'Sub-Category', pcs.pod_cat_subcat_id as 'cat_sub_id', pcs.pod_category_id as 'cat_id', pcat.pod_cat_name as 'Category', pm.created_datetime as 'Created', pm.pod_status as 'Pod Status', pm.nonFlash_status as 'Pod Non-Flash Status', pm.images_folder as 'images_folder' FROM pod_main as pm, pod_content as pc, pod_subcategory as ps, pod_category as pcat, pod_category_subcategory as pcs WHERE pm.content_id = pc.content_id AND pm.pod_cat_subcat_id = pcs.pod_cat_subcat_id AND pcs.pod_subcat_id = ps.pod_subcat_id AND pcs.pod_category_id = pcat.pod_category_id AND pm.pod_status != 3 ORDER BY pm.pod_status LIMIT $offset, $limit";
$result = mysql_query($query);
NetDebug::trace($query);
NetDebug::trace(mysql_error());
$this->countQuery = sprintf("SELECT COUNT(*) AS recordCount FROM pod_main WHERE pod_status != 3");
return $result;
}
function getSummary_count() { //allows for record paging
$query = mysql_query($this->countQuery);
$row = mysql_fetch_assoc($query);
return $row['recordCount'];
}