This topic is locked
[SOLVED]

 hideItem not working as expected

4/23/2020 4:03:27 AM
PHPRunner General questions
mbintex author

Hi,
with this code

$master = $pageObject->getMasterRecord();
if ($master["Kurzname"] != Null or $master["Kurzname"] !="" )

{

$pageObject->hideItem("inlineAdd12");

$pageObject->hideItem("addButton12");

$pageObject->hideItem("update_selected12");

$pageObject->hideItem("delete_selected12");

}


in BeforeDisplay event I want to hide some buttons, if the list is shown as detail list of a specific table which has the field "Kurzname".
Should work regarding to documentation:

https://xlinesoft.com/phprunner/docs/hideitem.htm
But all I get is
Fatal error: Call to undefined method ListPage_DPInline::hideItem()
Working with 9.8 still.
Is there a bug? An error in documentation or am I doing something wrong?

mbintex author 4/23/2020

PS. Tested with 10.4 and there didn´t manage to hide add and delete buttons for detail lists either.

$pageObject->hideItem("itemId");


does not seem to work on these items if the list is a details list.
Can anyone confirm or show me how to do it? Thanks in advance.

Sergey Kornilov admin 4/23/2020

This function didn't exist in PHPRunner 9.8. If you need to access the manual that comes with PHPRunner 9.8 click 'Help' anywhere in the software itself.

mbintex author 4/23/2020

Thought so. But tested it in 10.4 and it didn´t work there either - I wasn´t able to hide "add" and "delete" buttons dynamically when list is shown as a details list. Please advise.

Sergey Kornilov admin 4/23/2020

It works. You might be adding it to the wrong place or using the wrong Item IDs.

mbintex author 4/23/2020

sorry for the mess.
If you take the item IDs shown in Designer - it works for 10.4:

$master = $pageObject->getMasterRecord();
if ($master["Kurzname"] != Null or $master["Kurzname"] !="" )

{

$pageObject->hideItem("add");

$pageObject->hideItem("delete");

$pageObject->hideItem("grid_edit");

$pageObject->hideItem("update_selected");

$pageObject->hideItem("grid_view");

$pageObject->hideItem("grid_copy");

$pageObject->hideItem("grid_checkbox_head");

$pageObject->hideItem("grid_checkbox");

$pageObject->hideItem("sort_dropdown");

}


does the job.
It does not work with the itemIDs shown in the browser, because in the final html result "add" might be id "addButton3".

addButton3