Re: DB_DataObject and Structures_DataGrid integration

From: Date: Wed, 11 Aug 2004 15:52:31 +0000
Subject: Re: DB_DataObject and Structures_DataGrid integration
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32556@lists.php.net to get a copy of this message
Jackson Miller wrote:
The DataGrid maintainer is around. It may take a couple of days, but he will respond. I am not sure how active he is on pear_dev.
He's right here :)
I have integrated dataobject and datagrid numerous times when building CEP modules. I have also added HTML_QuickForm into the mix. Re-usable DG/DO integration has been on my todo list for a while, but time is a limited resource for me.
What are these "CEP" modules ? I want to implement this DataGrid/DataObject integration to increase my productivity for a specific project I'm working on. So, hopefully, it will save some of my time while contributing to PEAR :)
The main difficulty in using DataGrid with DataObject has to do with the pager. DataGrid determines the number of pages based on the number of records. When working with large database tables you don't want there to be DataGrid records for every record in the database. Once you use LIMIT in DataObject, paging is broken, and sort is pretty worthless.
Definitely, this is why the DataGrid has to call DataObject::limit() by itself when paging.
So I have had to run two queries, one to get the number of records and a second to get the records that will be displayed. This doesn't make sense if you have two pages of 50 records each (might as well select them all), but it is necessary if you have a million records in the DB.
By the way, if you work on big an complex databases, take a look at my #2086 bug report. The DataObject generator now supports database views.
Another shortcoming of DataGrid (especially when compared to .NET) is the ability to make rows "editable" in the DataGrid. I have hacked this together for my own needs, but it would be nice to see it available in the package.
I believe this is related to the FormBuilder. I don't know how far PEAR could go in trying to "clone" .NET. There should be some in-depth article on the subject. It seems like .NET provides some smart features/paradigm with these web controls ; _lots_ of research behind it I think. -- og

« previous php.pear.dev (#32556) next »