
Thanks,
Raymond
Put a face on your database
http://xataface.com/forum/
Hi Raymond,
There are a number of ways to reference records in a found set.Ê In the default list view, dataface using the row index because that allows it to refer back and forth between list view and details view without losing its place.Ê You can also reference them directly using primary keys.
If you already have a Dataface_Record object for the row in question, then you can get the url easily using the getURL() method.
e.g.
$record->getURL() : The url for the default action of that record.
$record->getURL('-action=edit') : The url for the edit form for that record.
$record->getURL('-action=foo') : The url for your custom action named foo on that record.
If you don't have your rows in a Dataface_Record object - no problem.Ê As long as your row is an associative array with at least the primary keys populated, you can do:
$record = new Dataface_Record('MyTableName', $row);
then you can do:
$record->getURL('-action=edit')
or whatever.
-Steve
Hi Raymond,
1.Ê You can make all of these calls in the presentation layer:
{$record->getURL('-action=edit')}
2. It is quite easy to generate the URLs manually.Ê You just need to know Dataface's URL conventions:
http://framework.weblite.ca/about/presentations/dataface_urls-ppt-2.pdf/view
E.g. you could do something like Click here
3. Using the row index does introduce the possibility of inconsistencies when selecting a record in list view, if between requests somebody deletes one of the records (or makes changes).Ê However, I don't believe that this is a major problem.Ê Most databases are updated infrequently.Ê And even if this situation does occur, all you will see is the wrong record - but that will be obvious.. It won't cause any erroneous changes to be made to the database.
Dataface always uses primary keys when updating the database so that no mistakes happen.
Hope this answers your concern.
Best regards
Steve