Announcement

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

    Custom DataSource Loader

    I need to do some post processing of my data source when it gets loaded. One use case is that certain field titles need to be pulled out of the database based on the user's login. Another is that I need to set some data source properties based on so attributes in the session (set by another process).

    What I would really like to do is extend the DataSource servlet so I can manipulate the DataSource object before its sent back out to the client. Then I can set properties, add remove fields, etc. and send the "scrubbed" response back out to the client.

    Are there any examples of this? I could create my own DataSource loader servlet and do what I am referring to, but if there is a way to do it with the native API then I would rather do it that way.

    #2
    See the QuickStart Guide, Server Framework chapter, right at the beginning - you want a DynamicDataSourceGenerator.

    Comment


      #3
      Thanks, works great.

      I see that DSField does not have a setProperty method in the API, I would like to override title in certain situations. How would I set this field, or would I have to create a new property on the field?

      Another question, can I remove fields from the data source definition? Again, in certain circumstances, I want to remove fields from the config.

      Finally, how can I set fields to be hidden in the grid initially? I tried using hidden=true, but that removes it completely and the user cannot add it back into the grid. Perhaps I can use this to remove columns, but again there is no setter.

      Comment


        #4
        Uhh you have a misunderstanding somewhere. DynamicDSGenerator allows you to return an XML DataSource definition. Once you've returned this dynamic definition, you'd can't subsequently modify it.

        If you think it through, you'll realize that wouldn't make much sense (how does it get out to browsers that have already loaded the DS, what does it mean if a field disappears after data has been fetched, dozens of other cases).

        Comment

        Working...
        X