How they do that? -- database displays like spreadsheet

How they do that? -- database displays like spreadsheet

by John DeBruyn -
Number of replies: 3

I would like to create a database that displays like a spreadsheet.  That is the way that the three example databaes in the docs display. 

Here is the page in the docs with the links to the three samples:

http://docs.moodle.org/en/Database_module#Example_databases

The data for each record in the three examples reads from left to right.  What I end up with has the several cells with information stacked on top of each other.  Mine looks clumbsy the three examples in the docs look great.

How do I edit the template to get the desired spreadsheet-like layout for my database?

 

Average of ratings: -
In reply to John DeBruyn

Re: How they do that? -- database displays like spreadsheet

by David Gill -
Hi John

Add more columns to the right, paste the fields over to those columns and delete the second and third rows.

The deletion of rows and columns is via the little 'x' symbol that appear when that column or row is selected.

The addition of same is done via the little left or right arrows either side of that 'x' symbol.

Hope that helps smile
In reply to John DeBruyn

Re: How they do that? -- database displays like spreadsheet

by Chris Porter -
Okay, I've been searching for how to do this all day and I've finally figured it out. I am self-taught when it comes to HTML and all of this business, so I really don't know what all of this means . . . I just know it works.

The following HTML code worked for me for the list template. I noticed the WYSIWYG editor likes to screw up the code once you save it, so I started copying my trial and error code into Microsoft Word until I figured it out. I'm sure there's an easier way, but here's what worked for me:

**Make sure you edit all three sections using the HTML editor**

HEADER SECTION:

<table class="modulesdata generaltable" align="center" border="1" cellpadding="5" width="80%"> <tbody>

<tr>

<th class="header" align="left">Date

</th>

<th class="header" align="left">Write Stuff Here

</th>

<th class="header" align="left">Options

</th>

</tr>


REPEATED ENTRY SECTION:

<tr><td>Date</td>

<td>Write_stuff_here</td>

<td>##Edit## ##More## ##Delete## ##Approve##</td></tr>



FOOTER:

</tbody></table></div><hr />


**PLEASE NOTE** that if you go back and fix stuff - the editor will add code that you didn't put there orginally. It was a huge pain to copy and paste every single time, but I'm very happy that I finally figured it out.



In reply to Chris Porter

Re: How they do that? -- database displays like spreadsheet

by Mike Harmon -

Thanks so much! This has been on my list for 4 years!  I added another trick that made my data show up even sharper.

In the repeated entry area I put the percent I wanted each column to take up.   Now my table is output with nice clean columns as well. I just had to divide the percentages up accurately. 

<table class="modulesdata generaltable" style="width: 80%;" border="0" cellpadding="0" align="left">
<tbody>
<tr>
<td width="25%">Winner</td>
<td width="10%">WSpeed</td>
<td width="10%">Wtime</td>
<td width="25%">Opponent</td>
<td width="10%">OSpeed</td>
<td width="10%">Otime</td>
<td width="10%">##Edit##</td>
</tr>
</tbody>
</table>

 I also found that I had to put the "create table" html line in the repeated entry box in Moodle2. Otherwize it turned my html back into text each time I left the HTML editor. 

The last change I made was the I created the same table above for the heading area. Then in the normal moodle editor I was able to make it bold and centered. I am pretty pleased with the results.

Thanks again!

Attachment database_entries.png