How can I list database information horizontally instead of vertically?
I want to change one of the database templates so it displays the information horizontally.
It's a weather database and I want the students to be able to analyze the data over several days and that's almost impossible when the information is displayed vertically.
For simplicity's sake, let say the information the students are collecting is the date, the temperature and the barometric pressure. How can I see that information in a horizontal list?
Re: How can I list database information horizontally instead of vertically?
<table style=" padding:5px; border-style: none; background-image: none; float: none; text-align: left; vertical-align: top;" border="0" frame="void" rules="none" width="100%">
<tr>
repeated entry type following:
<td>field1</td>
<td style="border-left-width:3px; border-color:black;border-left-style:solid;border-color:red;">field2</td>
in the footer section type following:
</tr>
</table>
Re: How can I list database information horizontally instead of vertically?
For anyone as inexperienced as I as and want to use the above as a model, I did have to add:
</tr>
in the repeated entry section to get it to work right.
Have some reading and experimenting, I put this in the top section:
<table style=" padding:5px; border-style: none; background-image: none; float: none; text-align: left; vertical-align: top;" border="0" frame="void" rules="none" width="100%">
<tr><TH colspan="1">field1
<TH colspan="1">field2
<tr>
This gave me some column headers. I'm not sure if that's the right way to do it, but it seems to be working!
Thanks again.
Re: How can I list database information horizontally instead of vertically?
I have a database that desperately needs to be displayed horizontally and I tried the two suggestions but without success. Could you explain it again, maybe in really simple absolute coding novice language?
I really appreaciate any help that's out there.
Re: How can I list database information horizontally instead of vertically?
In the template for List View create a table for the headings and a table for the data (see attached). The only additional thing I did was to go into the HTML code and change the percentages for the column widths so that coresponding columns were the same widths in the headings table and the data table. I have attached a screenshot and also an example database for you to try out in moodle - hope this helps.
Re: How can I list database information horizontally instead of vertically?
Re: How can I list database information horizontally instead of vertically?
-
##moreurl##
creates just the URL for the above link, useful for creating your own links. You can click on the link icon and type##moreurl##
into URL field or in source view type<a href="##moreurl##">fieldname</a>.
Listing database information horizontally instead of vertically?
After you have created the fields in the database click
> TEMPLATES
> LIST TEMPLATES
> and enter the following into the HEADER in HTML mode
<table style=" padding:5px; background-image: none; float: none; text-align: left; vertical-align: top; border-collapse:collapse" border="2" frame="void" rules="none" width="100%" bordercolorlight="#000000" bordercolordark="#000000" cellpadding="5">
<tr>
<TH colspan="1">Date
<TH colspan="1">Time (start-end)
<TH colspan="1">Contact (Name & extension)
<TH colspan="1">Purpose
<TH colspan="1">Edit
</tr>
> enter the following into the REPEATED ENTRY in HTML mode
<tr>
<td>
Date
</td>
<td>
Time (start-end)
</td>
<td>
Contact (Name & extension)
</td>
<td>
Purpose
</td>
<td>
##edit## ##more## ##delete## ##approve##
</td>
</tr>
Enter the following into the Footer in HTML mode
</table>
> click SAVE TEMPLATES
> click VIEW LIST
If all is well in the universe you should now see your database listed with each entry in a single row.
A screen image is attached and you can see the functioning database at http://www.baker-evans.com/community/mod/data/view.php?d=5
Unfortunately if you edit the template a filter in Moodle will validate the code and muck it up but if you keep the code in a external document you can just paste it back in and all will be well.
Does anyone know how or where to turn this off.
Peter Evans
Re: Listing database content horizontally instead of vertically
"Unfortunately if you edit the template a filter in Moodle will validate the code and muck it up but if you keep the code in a external document you can just paste it back in and all will be well. Does anyone know how or where to turn this off."
Hi Peter,
the first thing you should always do when entering one of the templates pages is to press the "Disable editor" button (unless the HTML WYSIWYG editor - which is really a bad thing there - is already disabled).
Best practice is to have a development instance of the same Moodle version, where you maintain a copy of the life database activity. Do all modifications of HTML templates always within a real good HTML editor app - and never directly in Moodle's interface. When you are finished, just select the entire text in your external editor app, copy & paste it into the corresponding field of Moodle's template pages. Finally, press the "Save template" button to make the changes effective.
Everytime you have changed something of the templates or fields, I would advise to go to the "Presets" tab and export as zip.
In your life Moodle, import the preset zip you have exported from the development instance.
Note that this process only works well as of the current 1.9.1+ weekly snapshot.
Best regards,
Robert
Re: Listing database content horizontally instead of vertically
Good day all,
My aim is to get the most recently added items to be highlighted for attention after being listed vertically. I managed to get the vertical listing to work after following the instructions on this thread. Can someone point me the way to get the highlighting to work?
Thanks
Madhu
Re: Listing database information horizontally instead of vertically?
Unfortunately if you edit the template a filter in Moodle will validate the code and muck it up but if you keep the code in a external document you can just paste it back in and all will be well.
Does anyone know how or where to turn this off.
One way to avoid this unfortunate but sometimes necessary behavior is to write the table with javascript. In the header you define a string variable to which you then add the relevant table parts from each section of the template and finally document.write it in the template footer. Something like:
Header script:
var strHtml="";
strHtml+='..'; // open table and header row
strHtml+='..'; // data row; the template generator do the loop on this script command and you get all rows.
Footer script:
strHtml+='..'; // close table
document.write(strHtml);
回應: Listing database information horizontally instead of vertically?
Re: 回應: Listing database information horizontally instead of vertically?
Hi Anderson,
When you are following Peter's guide, make sure you have clicked on the 'Disable Editor' button once.