Announcement

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

    Dynamically generating DataSources ( using addDynamicDSGenerator )

    I'm trying to use the addDynamicDSGenerator API to generate a dynamic set of fields for a datasource a grid is attached to.

    I was able to get the addDynamicDSGenerator() to load/register a new DynamicDSGenerator successfully by extending the DataSourceLoader class and having it add/register the generator following the instantiation of DataSourceLoader (super()).

    In my client I am calling DataSource.load("myPrefix_mySuffix") and I see the DynamicDSGenerators's getDataSource() method being called.

    My question is how can I get client context information to the DynamicDSGenerator's getDataSource() call?

    I need to be able to filter/adjust the fields created for a DataSource using by a set of context-value pairs and a company ID. I was hoping to be able to somehow inject this information in the DSRequest which is a parameter to getDataSource() but am not sure how to do that.

    I only see the getDataSource() being called when i call DataSource.load(myPrefix_mySuffix) in the client, calls to DataSource.get(myPrefix_mySuffix) do not trigger the call to getDataSource() for me. Should it?



    Be sure your post includes:

    1.SmartClient Version: v8.3p_2013-02-08/PowerEdition Deployment (built 2013-02-08)

    2. not browser specific

    3. Not a failing request issue.



    6. sample code if applicable

    Posts with incomplete information are much more likely to be ignored.

    #2
    Whatever context you need to generate the DataSource should be embedded into the DataSource ID in some way. The DataSource ID is what's used to uniquely identify the DataSource for pooling and other purposes, not the DSRequest.

    Comment


      #3
      So I would build an ID string to represent a Datasource that corresponds to this context. There could be a number of context key-value pairs, maybe 20 or 30..

      Is there a length limit to the ID string?

      Comment


        #4
        No limit that you could reasonably hit - URLs in general, for example, are limited to 4K, so think about this when using the DataSourceLoader Servlet from a <script> tag.

        Comment


          #5
          Ok, Thanks Isomorphic..

          Comment

          Working...
          X