How to get the records' URL in a custom action report?
4 posts
• Page 1 of 1
Seems the framework is using the table row index to access each record from the URL. That is the row position of that record in the table. In my custom report, I run a sql query to retrive a set of rows, but how do I get the row index of each of them so I can construct the URL in my custom report.html.
Thanks, Raymond
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. 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 Steve:
Thanks for your reply, I will give it a try. Is that possible to accomplishe the same thing in the presentation layer (smarty, html template)? Also, it we are using row index to reference a record in the list view and details view, what happen if that record is deleted by another concurrent user? Thanks, Raymond
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: 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
4 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 31 guests |