When clicking on a related field in the edit view of a record, i can filter the popup with initial_filter in editviewdefs.
However this does not seem to have any effect in the detail view - so the initial filtering is lost when editing the record via inline editing.
How can i apply an initial filter to a related field from the inline-edit, or from a related field in a quickcreate view?
You need to add your filter to popup view the same way you did it to the detail view because they are independent.
that doesn’t seem to work for me:/
If i add the following to custom/modules/modulename/metadata/editviewdefs.php , the initialfilter works correctly.
displayParams’ => array ( ‘initial_filter’ => ‘&account_type=Council’,),
However if i add the same line in custom/modules/modulename/metadata/detailviewdefs.php, the popup that shows for an in-line edit, does not apply the filter.
EDIT:—ahh… i think i misunderstood you sorry… do you mean add it to popupdefs.php?
What i am trying to achieve is that the initial filter is different when called from each parent module - for example, when selecting and account from the ‘sites’ module the initial filter sets the account type to ‘council’, whereas when selecting the account from a ‘project’ module the initial filter is the account type to ‘client’
You have to modify custom/modules/modulename/metadata/popupdefs.php. If it doesn’t exists, then make a copy from modules/modulename/metadata/
it doesn’t seem to have any effect?
And if it did, wouldn’t that mean the initial filter would be applied to every instance of the popup, no matter which module was calling it?
just cant get my head around it sorry, thank you for the help,
The initial filter is applied to edit view, but is not applied when using inline edit
I am also looking for the same.