Put link into list view when cell contents are empty

A place for users and developers of the Xataface to discuss and receive support.

Put link into list view when cell contents are empty

Postby rtresidd » Tue Sep 18, 2012 8:33 pm

Hi I'm not sure of a nicer way to do this but I added a quick hack to the RelatedList.php code to insert "_____" when the value to be inserted into the cell is empty.
This resulted in some text in the cell that would create a link you can click on..
Had issues mainly on related tables where the user wanted to edit a field in a certain column but there was no link there to take them to the correct related record entry for editing the field.
The field in question was on the join table, which I've usually hidden from view.
You could still do it by selecting the row and then hitting update, but you then have to select the correct field via a drop down etc.. easier via the link.

Not sure if there is a way to make the whole cell clickable in this case??
Please ignore the rev numbers I have a local svn copy to keep track of my changes..

Code: Select all
Index: RelatedList.php
===================================================================
--- RelatedList.php   (revision 882)
+++ RelatedList.php   (working copy)
@@ -473,7 +473,10 @@
                     $cellClass .= ' '.$srcRecord->table()->getType($key);
                     $renderVal = $this->renderCell($srcRecord, $field['Field']);
                     if ( isset($renderVal) ) $val = $renderVal;
-                     else if ( $link and !@$field['noLinkFromListView'] and !$this->noLinks and $rrec->checkPermission('link', array('field'=>$key))) $val = "<a href=\"".htmlspecialchars($link)."\" title=\"". htmlspecialchars($title)."\" data-xf-related-record-id=\"".htmlspecialchars($srcRecordId)."\" class=\"xf-related-record-link\">".$val."</a>";
+                     else if ( $link and !@$field['noLinkFromListView'] and !$this->noLinks and $rrec->checkPermission('link', array('field'=>$key))) {
+                if($val == "") $val = "_____";
+                $val = "<a href=\"".htmlspecialchars($link)."\" title=\"". htmlspecialchars($title)."\" data-xf-related-record-id=\"".htmlspecialchars($srcRecordId)."\" class=\"xf-related-record-link\">".$val."</a>";
+              }
                     echo "<td class=\"$cellClass $rowClass $accessClass\">$val</td>\n";
                     unset($srcRecord);
                  }
rtresidd
 
Posts: 14
Joined: Sun Aug 19, 2012 8:23 pm

Re: Put link into list view when cell contents are empty

Postby shannah » Mon Sep 24, 2012 9:30 am

Thanks for posting this.

I don't foresee any problems with your solution.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 19 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved