Categories > TinyButStrong general >

Headergrp and different block types

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Tobi
Date: 2007-01-11
Time: 07:27

Headergrp and different block types

Hi,

I want to use the headergrp feature to get this result:

<table><tr class="header">
<td>Name</td><td>Module</td><td>Aktion</td></tr>
<tr><td>change images</td><td>images</td><td>ACT_upload, ACT_upload_, </td>
</tr></table>

So I tried this kind of template

<tr>
<td>[priv.name;block=td;headergrp=id]</td>
<td>[priv.module;block=td;headergrp=id]</td>
<td>
<span>[priv.action;block=span]</span>
</td>
</tr>

But after rendering one <td> is missing:

<tr>
<td>change images</td><td>images</td><span>ACT_upload</span><span>ACT_upload_</span>
</td></tr>

Can anyone help me?
By: RwD
Date: 2007-01-11
Time: 09:32

Re: Headergrp and different block types

Can you show us the resultset or the array you send to the priv block?? And the php code? I've never seen tbs remove any element without me telling it to do so...

btw, there is a html element which is to be used for header rows:
<table>
<thead>
<tr>
  <th>Name</th>
  <th>Module</td>
  <th>Aktion</th>
</tr>
</thead>
<tbody>
...as normal...
</tbody>
</table>
By: Tobi
Date: 2007-01-11
Time: 18:22

Re: Headergrp and different block types

Okay, I do a mysql query and as array it look this way:

$result[0] = array('id'=>'1', 'name'=>'change images', 'module'=>'images', 'action'=>'ACT_update') ;
$result[1] = array('id'=>'1', 'name'=>'change images', 'module'=>'images', 'action'=>'ACT_update_a') ;
$TBS->MergeBlock('priv',$result);

And thats my template

<table>
<thead><tr class="header">
<th>Name des Rechts</th>
<th>Modul</th>
<th>Aktion</th>
</thead></tr>
<tbody><tr>
<td>[priv.name;block=td;headergrp=id]</td>
<td>[priv.module;block=td;headergrp=id]</td>
<td><span>[priv.action;block=span]</span></td>
</tr></tbody>
</table>

So you can test it yourself, it´s really unnormal
By: sheepy
Date: 2007-01-13
Time: 11:00

Re: Headergrp and different block types

I thought there was a mix up of table header and group header, but upon closer look I realised you're almost there.

You need to group the data by id, yes, however you'll need both headergrp (for name and images) as well as footergrp (for </td></tr>).  I'll use parentgrp for the row to simplify matter.  Note that the group only needs to be declared once.

<table><tr class='header'><th>Name des Rechts</th><th>Modul</th><th>Aktion</th></tr>
<tr>
<td>[priv.name;block=tr;parentgrp=id]</td><td>[priv.module]</td>
<td><span>[priv.action;block=span]</span></td>
</tr>
</table>
By: Tobi
Date: 2007-01-13
Time: 15:37

Re: Headergrp and different block types

you´re really smart!

thank you very much, it worked!!