Announcement

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

    Composite Foreign Keys?

    I don't see any examples of Parent/Child or Master/Detail using nested grids or grid.fetchRelatedData in the showcase where the relationship is defined by composite keys.

    Perhaps I'm missing something.

    If such a capability exists, can someone point me to specs or examples, and if it does not exist, how easy is the capability to expose or sponsor?

    #2
    We advertise support for only single primaryKeys and show you how you could create a single-field primaryKey value dynamically for client-side use in the doc for DataSourceField.primaryKey.

    In reality, many but not all components support multi-field keys if you just mark more than one field as a primary key. In particular the tree does not.

    You could sponsor the capability of the DataSource to essentially form a single composite key automatically. You would then have an API like DataSource.getPKValue(Record) to be able to get the generated key value for use with APIs that take a singular PK value.

    Comment


      #3
      Great reply, as per usual. Thanks for the help.

      Comment


        #4
        (Sorry...meant to post this standalone.)

        Comment


          #5
          Isomorphic stated:

          "In reality, many but not all components support multi-field keys if you just mark more than one field as a primary key. In particular the tree does not."

          Then is the 'tree' the only exception, or are there others?

          A full list of components that support multiple keys would be useful. That way if I am only using those components then calling 'transformResponse' to create a composite key would not be necessary.

          Does such a list exist? If not how do can I find out what components support multi-field keys and what do not?

          Thanks

          Comment


            #6
            To clarify, no components "support" multiple primary keys in the sense of it being an API that is documented or where it would be valid to report a bug against it. The only supported approach is a single primary key.

            Comment


              #7
              An update: as of SmartGWT 3.1, composite primary keys are now officially supported, but still not recommended, and are still not supported for Trees with modelType:"parent", where a singular unique value per node is still required.

              Comment

              Working...
              X