This topic is locked
[SOLVED]

 Detail View prevent add in Listview

5/17/2016 6:08:21 AM
PHPRunner General questions
A
aalekizoglou author

I have a master - detail with the master listview showing records from detail in listview and edit page. I want to prevent adding new detail records when in listview of the master page. Still allow adding new records when in edit view of master page.
Is that possible somehow?

Sergey Kornilov admin 5/17/2016

A couple of ideas come to mind. Neither of them is perfect.

  1. Use some Javascript code to hide details table Add button while on Master List page.
  2. Create a custom view of details table. Disable Add function for this custom view. Display this custom view as details on the master list page. On Add/Edit/View pages display the main details table with Add function enabled.

A
aalekizoglou author 5/18/2016



A couple of ideas come to mind. Neither of them is perfect.

  1. Use some Javascript code to hide details table Add button while on Master List page.
  2. Create a custom view of details table. Disable Add function for this custom view. Display this custom view as details on the master list page. On Add/Edit/View pages display the main details table with Add function enabled.


Sergey,
I tried with $xt->assign("container_recordcontrols", false) in the BeforeShowList of the detail table, but this is not respected. On the contrary the entire rnr-tabelemheader is build with javascript, so there is something missing I suppose.

I actually wanted to have the BeforeShowList run for detail view as well, since I want to hide record controls, and not allow inline editing as well.

Javascript is building a new rnr-tabelemheader rather than having the <DIV class="rnr-c rnr-ch rnr-c-recordcontrols">
So going with $("td[class^='rnr-tabelemheader']").remove() in the OnPageLoad of the detail removes the td after it has been created.
For the 2nd idea, if I create one custom view and join it in the master table, both the detail table and the custom view are show on my master listview. In the table link properties I have no option to show or hide a detailview from the listview.

Sergey Kornilov admin 5/18/2016

In regards to first suggestion - you should be able to do that in Javascript, I'm not quite sure I understand why you trying to remove a whole TD. You only need to hide Add link/button.

A
aalekizoglou author 5/24/2016



In regards to first suggestion - you should be able to do that in Javascript, I'm not quite sure I understand why you trying to remove a whole TD. You only need to hide Add link/button.


Correct, but I need to save space on mini tablet/laptops (11.6") as well. Did that in javascript.
Thanks.