Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-01-2006, 02:28 AM   #1
haleh
Registered User
 
haleh's Avatar
 
Join Date: Aug 2005
Posts: 7
Default Problem displaying next page of results in datagrid

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'];
    } 
haleh is offline   Reply With Quote
Old 06-01-2006, 09:30 PM   #2
haleh
Registered User
 
haleh's Avatar
 
Join Date: Aug 2005
Posts: 7
Default Paging problem solved...now sorting won't work

Ok, the problem seemed to be the fact that the datagrid wasn't bound directly to the recordset but instead to the dataset. When I removed this line of code:

grid.dataProvider = ds_gems.dataProvider;

and replaced it with:

grid.dataProvider = re.result;

paging worked. BUT, now sorting isn't working on the datagrid. At all. What a pain!

This is making me rethink my design, i.e. RecordSet->DataSet->DataGrid. Why do I need the dataset when I have a recordset that holds the data and allows me to manipulate it? If something changes in the recordset I can listen for it and send the changes back to my php class to update the database, correct?

So question: what are pros/cons of using
RecordSet->DataSet->DataGrid vs. RecordSet->DataGrid ??
haleh is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid initial selected index problem exmedium Components 1 04-24-2006 03:27 PM
Wierd problem with Datagrid and Textfield hari-kj ActionScript 2.0 0 01-04-2006 09:05 AM
Problem with form results and 'if' statement clare73 ActionScript 2.0 5 06-23-2005 09:25 AM
Is there a way of displaying a HTML page within a movie? aligator_am Simple Stuff (Newbies) 1 08-10-2004 01:55 PM
Using Frame.. Flash Nav bar have problem calling Html page oct10 ActionScript 1.0 (and below) 5 09-24-2001 08:24 PM


All times are GMT. The time now is 09:29 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.