- Parent Category: FAQs
- Category: EasyTable
- Created on Monday, 23 January 2012 20:07
- Hits: 3553
With EasyTable Pro's field options you can combine several fields to produce a custom URL for each record. There are lots of things you can do with URL's you may want a custom text for each click link or you may want to set a subject in an Email link, or you may want to have a large version of an image appear in a lightbox.
As we've already looked at how to acheive those, in this FAQ we'll take that a little bit further by displaying the Detail view of a row/record in a lightbox.
First up make sure you have a current version of JCE and JCE MediaBox installed (don't forget to check the MediaBox plug-in is enabled).
To start with every table has a unique ID or number, you can find this in the EasyTable Editor (see the Table Info panel in the top right of the Editor screen, shown below).
or the table list in the EasyTable Pro Manager (see the left most column):
As you can see our US Presidents table has an ID of 123, remember this number - we'll need it soon.
For the purposes of this FAQ we're going to add our custom Detail link to the Presidency field (ie. which number President) additionally our table has fields with the following names and alias. ( I'm using the Presidency field as we already have a standard "Detail" link on the President field. )
The other field that every table has is an automatic one created by EasyTable Pro called ID this is the unique index for each record in a table (Note: there is no settings row for the ID field in the EasyTable Editor, it used internally by EasyTable Pro and the database).
Some typical records might be:
Just the Details Mam!
There are a few more things we have to do here, first we have to get EasyTable Pro to return just the record/row. We can do this thanks to a feature of Joomla!'s MVC system, any component that implements the MVC properly can be called with an extra parameter on the URL.
Joomla! URL's are usually changed by Search Engine Friendly features to give you nice human readable results, however, underneath that they look more like this:
Thanks to Joomla!'s MVC mechanism (and EasyTable Pro implementing it properly) we can add this little snippet to our URL to get back the records detail view without all of the rest of surrounding template elements.
Using EasyTable Pro's tokens we will replace the record ID in the URL above with the #id# (this will automatically insert the right id for each record in the list view). The table ID (123 remember) is already in this URL but you will need to change it to the ID of your table on your website.
A View in A Box, Lightbox That Is!
So, we have to create a link to the detail view using all these elements. Using the example table and records to achieve this with EasyTable Pro you need to take several steps first:
- set the field "Presidency" to a type of "TEXT" (this prevents EasyTable Pro apply type specific formatting to the field).
- set the field options to the following:
- The URL includes the reference to the table in the segment &id=123, the other values row/record ID, President and Presidency are all inserted by token replacement.
Now when EasyTable Pro renders the table any field tokens will be replaced by the values in those fields. With our example table this will produce the following HTML:
|EasyTable Pro generated HTML||In Browser Display|
|<a rel="presidents;width;height" target="_blank" title="George Washington" href="http://j15ref.craigphillips.biz/index.php?option=com_easytablepro&view=easytablerecord&id=123&rid=1&tmpl=component" class="jcepopup">1<span class="jcemediabox-zoom-link"></span></a>||1*|
|<a rel="presidents;width;height" target="_blank" title="John Adams" href="http://j15ref.craigphillips.biz/index.php?option=com_easytablepro&view=easytablerecord&id=123&rid=2&tmpl=component" class="jcepopup">2<span class="jcemediabox-zoom-link"></span></a>||2*|
*Please note the examples in the table above are using the CSS from the template on the demo server.
Issues to consider!
- As you're displaying the Detail view you may want to turn off the field you use to create the custom Detail link in the Detail view - you can see in the demo website we haven't done this and you can click on the Presidency link inside the lightbox view of the record.
- You may want to turn of the Next/Previous Record links (we haven't and you can see the result).
Thats it. If you have any questions about EasyTable Pro and this FAQ just jump into the Subscribers Forum and ask away.