Page 1 of 1

Changin the Current Record variable in details view

PostPosted: Mon Jun 23, 2008 9:10 am
by meta
Hi Steve, hi all,

long time ago I read somewhere in the forum that the Current Record: variable in details view always grabs and displays the first char / varchar / text field of the currently displayed record.

Is there a possibility to change this on a per table basis?

An example: I have a table with customers. It is organized like this:

cust_id (int) (autoincrement) (primary key)
firstname (varchar)
lastname (varchar)
company (varchar)
company_id (int)
[...]

Every time I see a record in details view I will see Current Record: firstname

I would more like to see Current Record: company or even Current Record: company_id

Can I change this somewhere only for that table and not for the whole app?

I am using 1.0-beta-3 now.

Thank you
Markus

PostPosted: Mon Jun 23, 2008 9:13 am
by shannah
That can be done with the getTitle() method:

Code: Select all
function getTitle(&$record){
    return $record->display('company_id');
}

PostPosted: Tue Jun 24, 2008 5:46 am
by meta
shannah wrote:That can be done with the getTitle() method:

Code: Select all
function getTitle(&$record){
    return $record->display('company_id');
}


Thank you very much. Works fine :)
Markus