Hello,
Is it possible – maybe by using some server event code – to set the maximum no of detail records shown using PreviewOverlay ?
Best Regards
/Poul
Hello,
Is it possible – maybe by using some server event code – to set the maximum no of detail records shown using PreviewOverlay ?
Best Regards
/Poul
I am having a bit of problem with this. In the other thread you said in reply to:
Filter with LIMIT doesn't work...you must use another one...
"Yes, that's why I recommend to use "Recordset_Selecting" server event to modify the $filter that match with the search/filter criteria."
But the function ew_AddFilter($sfilter, "Field1 = 1234") ads to the where clause in the select statement:
$filter = "(" . $filter . ") AND (" . $newfilter . ")";
So how can I limit this to say 15 records ?
/Poul
Well, I think I've just found out the solution for your case. Simply put the following code in "Row_Rendered" server event that belongs to your detail table:
// in this example, maximum records that displayed are 3; adjust it to yours!
if (CurrentPageID() == "preview" && $this->RowCnt > 3) {
$this->RowAttrs["style"] = "display: none";
}
This is a better, flexible solution - especially when there are many records (the example shown is for a requests table where RequestID is the key field):
// Recordset Selecting event
function Recordset_Selecting(&$filter) {
if (CurrentPageID() == 'preview') {
$filter2 = @$_GET['f'];
$filter2 = TEAdecrypt($filter2, EW_RANDOM_KEY);
if ($filter2 == '')
ew_AddFilter($filter, "1 = 0");
else {
// $filter3 = ew_ExecuteScalar("SELECT MIN(`RequestID`) FROM (SELECT `RequestID` FROM `client_requests` WHERE {$filter2} ORDER BY `RequestID` DESC LIMIT 0, 10) AS `preview_filter`");
// ew_AddFilter($filter, "`RequestID` >= '{$filter3}'");
ew_AddFilter($filter, "`RequestID` >= (SELECT MIN(`RequestID`) FROM (SELECT `RequestID` FROM `client_requests` WHERE {$filter2} ORDER BY `RequestID` DESC LIMIT 0, 10) AS `preview_filter`)");
}
}
}