renderCell help [SOLVED]

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

renderCell help [SOLVED]

Postby cantlep » Fri Mar 05, 2010 4:01 am

Hi All,

This is my first post. I've been having a look around the forum and it seems like a great community. On that note, I'm hoping someone might be able to help me.

As per this forum post - viewtopic.php?t=4091&highlight= I'm trying to do something similar.

I have a "Customers" table and a "SiteData" table.
In "Customers" one of the fields is "CompanyName", in "SiteData", CompanyName is pulled from the "Customers" table so that I can link sites to customers. (This all works fine).

What i'd like to do is...In the "Customers" table, click on one of the CompanyName links and have it display me all sites from the "SiteData" table that that particular CompanyName is assigned to.

I have this, but it doesn't seem to work.

in tables/Customers/customers.php

Code: Select all
<?php
function CompanyName__renderCell(&$record){
        return '<a href="'.DATAFACE_SITE_HREF.'?-table=SiteData&CompanyName='.$record->val('CompanyName').'">'.$record->val('CompanyName').'</a>';
}
?>


and in tables/Customers/fields.ini

Code: Select all
[CompanyName]
noLinkFromListView=1


When I have noLinkFromListView set, it just doesn't make it a hyperlink (which I guess makes sense) but I want it to make the link that i've specified above. If I don't have it set in fields.ini then it just points to the usual view that the rest of the fields point to (i.e. Usual functionality).

Can anyone help? Have I missed something stupid? Could I possibly ask anymore questions? ;-)

Thanks a lot.

Paul
Last edited by cantlep on Thu Mar 18, 2010 3:39 am, edited 1 time in total.
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: renderCell help

Postby cantlep » Fri Mar 05, 2010 6:44 am

Hi All,

I've had a bit of a breakthrough. It seems I was missing the following snippet in my php file

Code: Select all
class tables_Customers {
}


So now the link actually exists. However, the desination isn't really working (and I know why - coz it doesn't exist ;-) )

Here's what I have
Code: Select all
return '<a href="index.php?-action=list&-table=SiteData&CompanyName='.$record->strval('CompanyName').'">'.$record->val('CompanyName').'</a>';


What I want the output to show is the same as when I use the "find" functionality and select "Only show me Company blah" In this instance, the URL looks like this
Code: Select all
http://mysite/index.php?-action=list&-table=SiteData&-cursor=0&-skip=0&-limit=30&-mode=find&-recordid=SiteData%3FSiteDataIDM7&CompanyName=%3D2


Do I literally have to type that into the php file (substituting the necessary words for the $record variable)?

Thanks

Paul
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: renderCell help

Postby cantlep » Fri Mar 05, 2010 7:09 am

and....All sorted :-)

Code: Select all
return '<a href="index.php?-action=list&-table=SiteData&-limit=30&-mode=find&CompanyName='.$record->strval('BusinessID').'">'.$record->val('CompanyName').'</a>';


It was the BusinessID bit that sorted it. The URL wasn't found due to not being able to tie up the ID with the CompanyName.

I realise it's working but is this the best way to do it?

Thanks

Paul
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 39 guests

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