The application I'm working on has lots and lots and lots of datasources. I'd rather not load them all at once from the host page because it just takes forever.
The app is broken up into logical 'modules' with code splitting. What I thought I would do is load the datasources needed by each module when the module starts. So if I have 500 datasources in total, but the current module only needs 15 of them, I load the 15 and move on.
So the way I thought that could work is by using the DataSource.load client API.
The first thing I found is that you can't seem to localize datasource elements that way out of the box, because the standard DataSourceLoaderServlet doesn't know how.
So I wrote this goofy servlet that basically just includes a JSP which uses the isc i18n taglib. This works, but already I see that I have at least one problem with this approach:
I have 2 datasources, parentDS and childDS, where childDS inheritsFrom parentDS. parentDS has autoDeriveSchema="true", childDS does not. Which I think is right, otherwise childDS won't inherit fields from parentDS.
When I use childDS in some DynamicForm, the fields that are defined explicitly in either datasource are fetched & rendered correctly. The fields that are derived from the schema are not rendered. Setting form.setUseAllDataSourceFields(true) has no effect.
However, I _can_ actually refer to the 'missing' fields explicitly and have them appear. So if parentDS overrides the field1 definition as derived from schema, and childDS overrides field2 (and inherits field1) then form.setDataSource(childDS) gets me a form with only field1 and field2 on it. I have to create a TextItem(field3) and setFields (field1, field2, field3) to get it on my form.
In practice, this is what I'll almost always do anyway. So no big deal on its own. But if I use the provided DataSourceLoader servlet, this all just works out of the box.
So the point of all this is just that I'm beginning to doubt my usage of the DataSource.load API. Am I barking up the wrong tree here?
The app is broken up into logical 'modules' with code splitting. What I thought I would do is load the datasources needed by each module when the module starts. So if I have 500 datasources in total, but the current module only needs 15 of them, I load the 15 and move on.
So the way I thought that could work is by using the DataSource.load client API.
The first thing I found is that you can't seem to localize datasource elements that way out of the box, because the standard DataSourceLoaderServlet doesn't know how.
So I wrote this goofy servlet that basically just includes a JSP which uses the isc i18n taglib. This works, but already I see that I have at least one problem with this approach:
I have 2 datasources, parentDS and childDS, where childDS inheritsFrom parentDS. parentDS has autoDeriveSchema="true", childDS does not. Which I think is right, otherwise childDS won't inherit fields from parentDS.
When I use childDS in some DynamicForm, the fields that are defined explicitly in either datasource are fetched & rendered correctly. The fields that are derived from the schema are not rendered. Setting form.setUseAllDataSourceFields(true) has no effect.
However, I _can_ actually refer to the 'missing' fields explicitly and have them appear. So if parentDS overrides the field1 definition as derived from schema, and childDS overrides field2 (and inherits field1) then form.setDataSource(childDS) gets me a form with only field1 and field2 on it. I have to create a TextItem(field3) and setFields (field1, field2, field3) to get it on my form.
In practice, this is what I'll almost always do anyway. So no big deal on its own. But if I use the provided DataSourceLoader servlet, this all just works out of the box.
So the point of all this is just that I'm beginning to doubt my usage of the DataSource.load API. Am I barking up the wrong tree here?
Comment