jacem
Posts: 87
|
| Posted: 08/25/2008, 7:05 PM |
|
There are a few posts related to this problem however I don't feel I have found a solution that works for me:
I have an editable grid that allows both updates and inserts. If a user creates a new record or updates an existing record I have the 'dateupdated' field automatically being updated in the 'Custom Update' with the PHP expression time(). However I discovered, as others have in various posts on this fourm, that CCS3.x re-saves every displayed editible grid row whether the row has changed or not, when the user presses submit. Obviously it would have been a better event implementation, as in other areas of CCS, that the update only gets called if there is something changed to be saved for each individual row in the grid.
I have code in the onvalidaterow that detects that only updatable field has been changed (by comparing the current valid of the control with a hidden oninit populated copy of the control) and I have tried various methods to turn off the record save for that row: UpdateAllow=false etc...:
function prospectsegments_OnValidateRow(& $sender)
{
$prospectsegments_OnValidateRow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $prospectsegments; //Compatibility
$seg1 = $Container->SegmentID->GetValue();
$seg2 = $Container->previoussegmentid->GetValue();
if ($seg1<>$seg2) {
//something changed...better update the time & bywho
$Container->UpdateAllowed=True;
$prospectsegments->UpdateAllowed=True;
} else {
$Container->UpdateAllowed=False;
$prospectsegments->UpdateAllowed=False;
}
}
I have checked that the test is working with the test data.
I have also tried taking the time() out of the custom update for the dataupdated field and tried setting the time during the onvalidaterow event however it seems ccs triggers are not set up for controls do be modified during the onvalidaterow event -0 the change is ignored during the update.
While I am not a newbie with CCS, I am no expert. Same with PHP so please be gentle.
Any pointers would be appreciated.
|
 |
 |
|