Menu

How to use an specific tab when searching for a reference?

2023-07-28
2024-08-16
  • Gustavo Almeida

    Gustavo Almeida - 2023-07-28

    I have the entity A (id, age, B b) and B (id, name, description, amount, date etc).

    In B I have @View(name="simple", members="id, name") and @Tab(name="simple", properties="id, name")

    In A I can use @ReferenceView("simple") over B to use the simple view in detail mode .

    But, when I click the magnifying glass icon to search for B, I'm presented with the main (unnamed) @Tab of B, if it exists, or all the columns for B if there is no @Tab defined.

    Is there a way to reference an specific @Tab (like the "simple" above) for a reference? Similar to what we do with @ReferenceView? Something like @ReferenceTab("simple").

    Don't know if it makes sense, but it would be useful not only to simplify the search Tab but to benefit from the filtering capabilities of @Tab like baseCondition, defaultOrder, filter.

    I guess I can change the @SearchAction with some variation of this.

     
  • Gustavo Almeida

    Gustavo Almeida - 2023-07-31

    Thank you.
    For now I just created a simplified version of the Entity mapping to the same table and defined a simplified @Tab with baseCondition for filtering.
    Additionally, I had to use @AssertTrue with the same baseCondition of the @Tab to avoid the user to type a key and reference an instance that would not be selectable by clicking the magnifying glass.

     
  • Javier Paniza

    Javier Paniza - 2024-08-16

    Hi Gustavo,

    Since OpenXava 7.4 we have a new annotation, @SearchListTab to indicate the @Tab to use in the search dialog for references and collections. OpenXava 7.4 will be releases next month, in Septembre 2024.

     
  • Gustavo Almeida

    Gustavo Almeida - 2024-08-16

    Great. When it is out I'm going to change my code to see how it works.

     

Log in to post a comment.