Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DynamicForm: unnecessary querries based on foreignKey

    I have a DS with some foreignKeys defined.
    In the same DS, I have a few extraFields, which I populate using an SQL join, defined in the OperationBinding.

    This way, all the data is already available from one querry.

    * * *

    However, when I bound this DS to a DynamicForm,
    and start to edit a record with this DynamicForm,
    for all the fields with have foreignKeys, a query is generated automatically, and the related record is fetched.

    I have two questions about this:

    1. Is this really necessary? I have all the data prepared with JOIN, so this seems to be redundant. How do I disable this behaviour?

    2. If I wanted to, how could I access the results of such queries? I can see that they are used automatically to resolve the IDs into the title fields of the foreign table, but what else can I do with it?

    Thank you for your help!

    #2
    I have found out that I can disable this by calling
    Code:
    setFetchMissingFields(false)
    Question: I have _not_ specified the optionDataSource and the displayField.
    Are these automatically derived from the foreignKey?

    Comment


      #3
      Yes, it's automatically derived for foreignKey.

      For a SelectItem or ComboBoxItem, you can use getSelectedRecord() to get the related record.

      Comment


        #4
        Originally posted by Isomorphic
        Yes, it's automatically derived for foreignKey.
        This behavior is specific to DynamicForms, right?
        I have not noticed ListGrids doing the same...

        Comment


          #5
          It will occur in grids for inline editing, but not for normal rows. See listGridField.optionDataSource for how the overall system is intended to work.

          Comment

          Working...
          X