Re: Datagrid class in PEAR?

From: Date: Fri, 19 Apr 2002 12:01:41 +0000
Subject: Re: Datagrid class in PEAR?
References: 1  Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-5670@lists.php.net to get a copy of this message
le 19/04/02 11:28, Markus Wolff à wolff@21st.de a écrit : > Am Fri, 19 Apr 2002 10:36:26 +0200 schrieb Bertrand Mansion > <bmansion@mamasam.com>: > >>> I´ve already started to write my own component - if enough people are >>> interested, I could start to pearify it before I go on adding row >>> editing capabilities. Maybe there´s even someone willing to help? ;-) >>> Currently, the class makes use of DB, DB_Pager, IntegratedTemplate and >>> two of my own helper classes which may be replaced in the future. One >>> of these helper classes is a class for reading configuration files and >>> itself depends on XML_Tree. >> >> I don't know ASP.NET (or any other Microsoft products), could you post a >> link to some page describing it (with screenshots preferably). >> I am interested in your project. I believe this could use HTML/QuickForm and >> HTML/Table. > > I agree that using QuickForm might be a good idea, although I didn´t try > that package yet. I´ve been using HTML_OOH_Forms in past projects, but I > think for a datagrid class, that would be overkill. > > A good tutorial on using ASP.NET datagrids can be found here: > http://www.4guysfromrolla.com/webtech/122300-1.shtml > > This tutorial also illustrates what I´d expect from a PHP grid class, > although personally I wouldn´t go for the custom XML template tags which > are then transformed to "normal" HTML using XSLT - this makes it hard to > leave the design up to a designer who only knows HTML. > > As there seem enough people interested, I will clean up my existing code > this weekend and then post it along with API documentation and usage > examples. Then maybe we can work together from there. I have looked at the tutorial. My first impression is that with ITX, HTML_Table, DB and possibly QuickForm, we've got all the tools to make something at least as good and easier to use. The idea of passing templates to the cells is nice and wouldn't require so many lines of code if done with PHP and PEAR. For instance: $colHeader = 'Picture'; boundColumnName($DBField, $colHeader); $template = '<img src="{'.$DBField.'}">'; setColTemplate($colHeader, $template); // Sorting $sortQuery = 'select * from authors order by name'; setSortCol($colHeader, $sortQuery); or : $sortField = 'author'; setSortCol($colHeader, $sortField); or : $sort = array( $field1 => 'DESC', $field2 => 'ASC'); setSortCol($colHeader, $sort); or we could even use an object to set the sort parameters. Personally, I would prefer to use $colNum (0, 1, 2...) instead of $colHeader ('Picture', 'First Name', ...) because it is more abstract and then we don't need to modify HTML_Table to make it work. But using $colHeader is still feasible. Their dataset make me think about our DB result object ;) We need to find a name for the datagrid object which would fit the PEAR naming schemes. About the pages and limit options, I haven't used the limitQuery stuff from PEAR DB yet because I use mostly Oracle and feel more comfortable with my own code which generates Google like page numbers (they adjust automatically to the page you are). But I will give it a try as soon as we need it. IMO, this shouldn't be too much of a problem and can be implemented later. For instance, we could add a pageRange parameter which will adjust the number of pages displayed on top or below the record table. I have the feeling that QuickForm can be useful for editing features but the examples given where a bit scarce in the tutorial. Need more thoughts... Bertrand Mansion Mamasam

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