Method of conditionally hiding element in list view

ontarget

Active Member
Hi I have a list showing a bunch of elements.
I have a dropdown element called "Attended"
Values =
0 = Not Attended
1= Partially Attended
2 = Attended
In the list view each row contains a display element called "Print Attendance Certificate"
Is there a method of hiding the "Print Attendance Certificate" element in the list view if the Value of "Attended" = 0?
(Much like can be done with form_1.js)
 
[SOLVED]
Ok so here's what i did
on the display element "Print Attendance Cert"
I set eval'd = Yes then put in the following php ( i actually had another element recording hours so it was easier to simply say if hours = 0 dont allow printing!)

PHP:
$user = JFactory::getUser();
$userid = $user->get('id');


$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);

$myQuery
    ->select('hours')
    ->from('my_user_list')
    ->where('user_id = ' . $userid);


$myDb->setQuery($myQuery);
$hours = $myDb->loadResult();
if ($hours > '0')
{
return 'Print';
}
else
{
return '';
}

Although this works nicely can anyone explain how i would return the rowid of that particular record? I tried
PHP:
$row=$listModel->getRow($rowId);
in the evald field just to see what would be outputted but that breaks the page!
 
I would do it differently - using a calc element rather than a display element and setting the calc element to "Print Attendance Certificate" if value of Attended !== 0.

Interested in people's views of which of the solutions is considered best.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top