Your problem is calling the find method before the bind. Do not do this
as DataGrid will call the find for you so that you can do sorting and
paging.
While it is good not have to call the bind method in some situations in
others is very bad. I often limit the result of the query based on the page
and pass the count to totalItens of the pager so only the necessary data is
taken from the database is passed to datagrid the drawback is have to do
select count every time but still is better them have to select all the data
every time.
I apologize for any incorrect documentation, im working on it as we speak.
I will look into the Source class ... I think it is called S_DG_DataSource
but the filename is Source.php, so there may be a naming crisis here :)
Hehe this is new, never saw the documentation be most up to date to
the current release. This only show good work. :)
Just applied the Og patch to the CVS version and it is working great.
Tks for the help.
----- Original Message ----- From: "Andrew Nagy" <asnagy@webitecture.org>
To: <cron@odi.com.br>
Cc: <pear-general@lists.php.net>
Sent: Monday, December 13, 2004 7:40 PM
Subject: [PEAR] Re: Datagrid and DataObject and performance
cron@odi.com.br wrote:
Hello Again, After look at the examples just find to be allot easier to
just bind the data and let DataGrid do the work however I have this code
and it does not work: $obj_db = DB_DataObject::factory('acesso');
$obj_db->find();
$dg = new Structures_DataGrid(4);
$dg->bind($obj_db);
$dg->render();
Your problem is calling the find method before the bind. Do not do this
as DataGrid will call the find for you so that you can do sorting and
paging.
I apologize for any incorrect documentation, im working on it as we speak.
I will look into the Source class ... I think it is called S_DG_DataSource
but the filename is Source.php, so there may be a naming crisis here :)
The DataObject source driver should be ready to go, I was doing some heavy
testing on it today and I am 99% sure I have worked out all of the bugs,
please get the latest from CVS and let me know if you find any bugs
Thanks for the help and enjoy!
Andrew