This topic is locked

Hide field if is empty in multi row list page

3/27/2023 12:46:17 PM
PHPRunner Tips and Tricks
T
technoserv author

In my project I have put a list page with grid-type advanced 2 columns in which each record is displayed on multiple lines.
I tried setting the "hide if empty" flag but nothing happens.
I tried putting event in in "after record is processed" and also in "before display"
inserting the following code:
if (!$data["date_repl"]){
$pageObject->hideItem("date_repl");
} else {
$pageObject->showItem("date_repl");
}
The result is that the field and its contents are displayed on all rows, even where the condition is applied.
I also tried in "javascript onload event" with the following code:
var ctrldaterepl = Runner.getControl(pageid, 'date_repl');
if(ctrldaterepl.getValue() == ''){
pageObj.hideField("date_repl");
}else{
pageObj.showField("date_repl");}
result field always visible on all lines.
From what I understand it is only a problem on the list page with multi row grids as they work on a normal list page.
Can anyone help me? Thank you.

K
KM 7/30/2023

I am using PHPRunner
<ol> Set list page grid layout to vertical. On List Page After Record Processed event add the code below:
</ol>`if ($data["YourFieldName"] == "") {

$record["YourFieldName_fieldcolumn"] = false;

} else {

$record["YourFieldName_fieldcolumn"] = true;

}`