Re: DataGrid, DataObject and FormBuilder
| From: | Justin Patrin | Date: | Mon, 02 May 2005 16:38:10 +0000 |
| Subject: | Re: DataGrid, DataObject and FormBuilder | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19042@lists.php.net to get a copy of this message | ||
On 5/2/05, digit Shine <digit_shine@yahoo.com.cn> wrote:
> hi,
> I use structures_DataGrid to bind and display some
> DataObject objects,
> but it can not dipslay getLinks fields which have a
> "_" prefix. Does
> DataGrid has this function. If it can not do this, why
> it use formBuilder's
> options variable like fb_fieldsToRender and
> fb_fieldsLabels.
You're getting a few things mixed up here. I added the FormBuilder
stuff to the DataObject DataSource. If you want this to be used you
need to use the 'formbuilder_integration' option for DG in the bind
functions. Note: this has *nothing* to do with getLinks().
$dg->bind($do, array('formbuilder_integration' => true));
>
> is the code below correct:
No.
>
> $eb = new employee;
> require_once 'Structures/DataGrid.php';
> $dg =& new Structures_DataGrid(4);
> $dg->bind($eb);//$dg->bind($eb,$option);
You don't need to call find() on a bound DataObject. In fact you *should* not.
> $eb->find();
> while ($eb->fetch()){
> $eb->getLinks();
> }
The above does absolutely nothing. You're just (possibly) running the
query a second time here and screwing up DataGrid's results. Don't
call find()/fetch() or any other functions on the DO. You can set vars
and use whereAdd / joinAdd, but don't query on it.
> $dg->render();
> //$dg->dump();
> echo $dg->renderer->getPaging();
>
> bitShine
>
--
Justin Patrin