Jump to content

repeater Table


Martijn Geerts
 Share

Recommended Posts

Started a new module for creating <tables> from repeater fields.

Feel free to grab it from github, do with it what you want.

It only works for simple text based fields inside a repeater.

To use it:

$table = $modules->get("RepeaterTable"); // initialize
$table->thead = true; // (bool) true/false, default = true, will render <th>
$table->indent = 3; // (mixed) false/int, where int is the level of indentation, default: false
$table = $table->render($page->repeater); // repeaterfield called repeater
<!-- output -->
<table class="table-repeater">
	<thead>
		<tr>
			<th class="col-1">Fieldlabel field 1</th>
			<th class="col-2">Fieldlabel field 2</th>
			<th class="col-3">Fieldlabel field 3</th>
		</tr>
	</thead>
	<tbody>
		<tr class="row-1">
			<td class="col-1">data for field 1, first repeater item</td>
			<td class="col-2">data for field 2, first repeater item</td>
			<td class="col-3">data for field 3, first repeater item</td>
		</tr>
		<tr class="row-2">
			<td class="col-1">data for field 1, second repeater item</td>
			<td class="col-2">data for field 2, second repeater item</td>
			<td class="col-3">data for field 3, second repeater item</td>
		</tr>
	</tbody>
</table>

For the HTML purist, I have added source code indentation where you can set how many tabs you wish to append before each element.

Please let me know if I should add this to the modules directory ?

Does someone have a good name for this ?

Edited by Martijn Geerts
  • Like 13
Link to comment
Share on other sites

I have no plans to develop it further then this. For me it's just a time saver to build tables. If more people really like this module I can continue on this one. And add it to the modules directory to.

Can imagine I build in support for normal PageArray, manipute output etc. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...