Back

Editing, Updating and Creating Records
childLens
Replaces the details grid with an editor to create/edit records Legal settings:
Create and Edit | New record form is the default, unless a record is selected for editing
Edit Only | Always show the edit record form for the current record
Create Only | Always show the new record form
Edit and Create | Show edit record form for the current record is the default. When the new record icon is clicked, show the new record form in details
This is called childLens because internally, it creates a second phpLens object(the child) to do the editing. Syntax: $lens->childLens = '{id of child phplens}[;editdetail][;newdetail][;editfirst]'; The string editdetail is a constant that specifies editing is allowed in the detail grid. The string newdetail is optional and when defined, will display the create new record screen in the detail grid when no record has been clicked on. The editdetail constant must also be set for newdetail to work. The id of the child phpLens should be a unique value that is not used by other phpLens objects. Since phpLens 2.4, both editdetail and newdetail are optional. Since phpLens 2.4.8, a new optional setting, editfirst is available. When makes editing the default instead of creating a new record if both editdetail and newdetail are defined. Syntax `Example 1: Simple Example include_once('./phplens.inc.php'); session_start(); $db = &ADONewConnection('mysql'); if (!$db->PConnect('localhost','root','','db')) print 'Error:'.$db->ErrorMsg(); $lens = new PHPLens('editdet',$db,' select * from products order by 1 '); $lens->childLens = 'editdet2;editdetail'; $lens->canEdit = true; $lens->canDelete = true; $lens->canNew = true; $lens->Render(); $lens->Close(); Example 2: You want to modify the child phplens object so the top border is green. You will need to extend the Clone() method: include_once('./phplens.inc.php'); session_start(); class PhpLens2 extends PhpLens { function &Clone() { $lens = PhpLens::Clone(); $lens->colorNavBorder = 'green'; return $lens; } } $db = &ADONewConnection('mysql'); if (!$db->PConnect('localhost','root','','db')) print 'Error:'.$db->ErrorMsg(); $lens = new PHPLens2('editdt',$db,' select * from products order by 1 '); $lens->childLens = 'editdt2;editdetail'; $lens->canEdit = true; $lens->canDelete = true; $lens->canNew = true; $lens->Render(); $lens->Close();` Basic:No Advanced/Enterprise:Yes DynamicEdit:Yes [Version 1.2]