Forums

Customising a Date view in a table listing or view

Twincarb 04 Feb, 2018
Answer
1 Likes
I had a requirement to change the format of the date shown in both a table listing and also the view that goes with the table. It took an amount of searching to discover the answer because the date element in the table is also the link to the view.
The details below are taken from the views that I have set up and hope that someone will find them easily translatable.
Linkable Date with custom formating
In the table view I have the entries below to display the correct columns I want showing.
Columns List
JobsRead.date_time:Date
collectfrom.short_name:Collect From
deliverto.short_name:Deliver To
Rider1L.cb_wholename:Rider 1
Rider2L.cb_wholename:Rider 2
Rider3L.cb_wholename:Rider 3
Because the date element is also the link I need the follwing in:
Columns view
JobsRead.date_time:{view:job_view_link}
Because the link needs to know where to get its information from you need to use the Link element.
The boxes that need filling in are Content and URL/ URL parameters
Below is how it is set up without a custom date view shown.
Content
{var:table1.row.JobsRead.date_time}
Depending on the server setup this will display
04 02 2018 08:03:16
Now in order to display the link with a custom date you will need to edit it as below. This is customisable or how you want the display to show in the example below it displays
04 Feb 2018 08:03
{date:d M Y H:i$(var:table1.row.JobsRead.date_time)}
HTML Output View
Now to display the custom date in the View you just need to edit the function correctly
The standard way of pulling the data from the database is as follows which breaks down to {var:function_name.Model.database_column}
{var:read_job_data.JobRead.date_time}
To be able to customise the view we take the same format that we used before and this will allow you to display the date as you wish to
{date:d M Y H:i$(var:read_job_data.JobRead.date_time)}
I hope that this helps at least one person🙂
Dave
Max_admin 04 Feb, 2018
Thanks Dave!🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger