2009年3月16日星期一

Re: [fw-mvc] [ZF 1.7] [Zend_Form] Header for a table

Hi

hmmm, I gave inaccurate and misleading information, sorry.
But I am glad you had reached the final answer.

My mistake is that $decorators are unnecessarily added on eachloop.

The reason is that i copy and paste it from my source code
of the DisplayGroup it has "OuterDecorator Logic"
without thinking about what happens next.

Thank you so much for your pointing out

regards

2009/3/16 lesquale <cedbourgeon@hotmail.com>:
>
> Hi
>
> Thanks a lot and sorry to answer so lately to your precious help - we
> finally managed to generate the table header as we wished, based on your
> last answer.
>
> However, just in case, i want to precise that the sample you give us :
>
>
> Tomoaki Kosugi wrote:
>>
>> --------
>> $decorators[] = new Zend_Form_Decorator_Label();
>> $decorators[] = new Zend_Form_Decorator_HtmlTag(array('tag' => 'th')));
>> $tmp = '';
>> foreach ($decorators as $decorator) {
>>     $decorator->setElement($item);
>>     $tmp = $decorator->render($tmp);
>> }
>> $items[] = $tmp;
>> -------
>>
>
> The result is smthg like :
>
> <th>label1</th>
> <th><th>label1lable2</th></th>
> <th><th><th>label1label2label3</th></th></th>
> ...
>
> maybe you already now that - but just in case ;)
>
> on our side, we finally ended with this working code :
>
> at the beginning of the Render function :
> $LabelDecorator = new Zend_Form_Decorator_Label();
> $LabelItemsHtmlDecorator = new Zend_Form_Decorator_HtmlTag(array('tag' =>
> 'th'));
>
> within the Render function, last orders of the foreach loop (where was the
> original line : $items[] = $item->render(); ) :
> $LabelDecorator->setElement($item);
> $LabelItemsHtmlDecorator->setElement($item);
> $items[] = $LabelItemsHtmlDecorator->render($LabelDecorator->render(''));
> --
> View this message in context: http://www.nabble.com/-ZF-1.7---Zend_Form--Header-for-a-table-tp22375408p22534044.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>

没有评论: