Quick Tip for Databases: A nice layout for the list view

4776

I’ve been working on a Job database for a Moodle site and while Moodle.org’s Job database has been a great example to follow there were a few things not as obvious to the creation which would be great to know starting out. One of the things I struggled with until I found the answer in the forums [https://moodle.org/mod/forum/discuss.php?d=84050] was how to get the List display to look nice like the one on Moodle.org (usually it’s just like the single entry view, but with scroll of death if you have lots of entries).

Post Pages - Post Inline - WIRIS

The trick is treating each of the text areas as one (essentially) with the repeating rows highlighted in the middle column. Once you understand this formatting the list view is pretty simple. One of the first helpful things to do is to disable the editor when working with the “List template” page.

db list view

In the example,

  1. is your table header with the first row. These are you column headers for when viewing the list view as a table.
  2. is your repeating rows (they’ll be listed and formatted as the rows in a table showing as many as are available to view)
  3. your table end tags

With this setup you have something that looks like this:

db list view2Additionally, through some predefined search queries you can make all sorts of landing pages for the various ways you might want to filter your database (in  this case “job offered” might have a quick short cut or link different from “seeking job”. Once you get over the hurdle of creating fields the Database can be a very useful and flexible tool.

Read more about the Database Activity here http://docs.moodle.org/26/en/Database_activity_module