Re: DB_DataObject and Structures_DataGrid integration
| From: | Jackson Miller | Date: | Wed, 11 Aug 2004 17:51:29 +0000 |
| Subject: | Re: DB_DataObject and Structures_DataGrid integration | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32560@lists.php.net to get a copy of this message | ||
On Wednesday 11 August 2004 12:24 pm, Justin Patrin wrote:
> Something like this might work:
>
> //to get # of records
> $count = clone($this->dataObject); //or whatever it is in DataGrid
> $numRecs = $count->find();
This is a problem (I think). Correct me if I am wrong, but it seems this will
select all the records from the database. What I have been doing is creating
a count parameter that uses the same where clause, but only returns one row
of data.
> I haven't looked at the DataGrid code myself, so I don't know how hard
> this will be to integrate into the current code. I would suggest
> having multiple backends which bind() uses. Since bind() is used on an
> already instantiated object, you can't easily use a factory. However,
> you could instantiate a $this->_dataSource based on the type of the
> input to bind and change the internal DataGrid calls to use that
> instead. All current array-based functionality would have to be moved
> to something like DataGrid_Source_Array. Then you could have a
> DataGrid_Source_DataObject.
>
> > > 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.
>
> This is related to FormBuilder, but it all depends on how you want ot
> support this. I've done some fancy Javascript stuff before to
> dynamically create a form in a table. This could be done, if people
> are interested. I could even write such a beast. :-) For a simple
> alternative, DataGrid could add an Edit column which has a link. When
> the user clicks the link, it displays a FormBuilder QuickForm. This
> could easily be controlled by an option to DataGrid.
DataGrid already has the ability to have edit links. (example:
http://phpenterprise.net/dg.php). However, in that
example, my editable rows
are a hack. I would like to see editable rows in DataGrid (only the HTML
renderer), and I would like to see it allow multiple rows to be edited at the
same time.
>
> > 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.
>
> Never used .NET myself, but I like the way that this package is going.
I have been working on a DataGrid tutorial. I will finishi it up and get it
out there.
-Jackson
>
> > --
> > og
>
> --
> DB_DataObject_FormBuilder - The database at your fingertips
> http://pear.php.net/package/DB_DataObject_FormBuilder
>
> paperCrane --Justin Patrin--