Hi there
I'm developing a custom widget with a list which contains values from a feature class and a table mixed together for each row. The table and the feature class has a common id. Because the feature class und and table are branch are versioned I can't do a join in the FeatureService. So I have to join the feature class and table in the custom widet. Is there way to create a custom datasource which contains the joined data from the datasources defined in setting.tsx. An other ideas was to pass two datasources to the DataSourceComponent. Does any one has experiences with this?
Hi @Zoggo ,
You can use MultipleDataSourceComponent or two DataSourceComponent. To use MultipleDataSourceComponent -
import { MultipleDataSourceComponent } from 'jimu-core'
...
<MultipleDataSourceComponent
useDataSources={props.useDataSources}
onDataSourceCreated={onDataSourceCreated} // (dss: { [dataSourceId: string]: DataSource }) => void
onDataSourceInfoChange={onDataSourceInfoChange} // (infos: { [dataSourceId: string]: IMDataSourceInfo }) => void
queries={getQueries(useDataSources)} // { [dataSourceId: string]: QueryParams }
widgetId={props.widgetId}
/>
This is great, but it's the only reference I can find for "MultipleDataSourceComponent". I don't see any documentation on developers.arcgis.com. I see it in code and can plug my way through using it. Is this missing documentation or should I take it's lack of documentation as a sign to avoid using "MultipleDataSourceComponent" and simply use multiple "DataSourceComponents" and a logic gate to sense once they've all loaded their data source?
Hi @youknowww,
Using MultipleDataSourceComponent can cause performance and rendering issues, which is why it is not officially documented.
For example, it may wait for all data sources to be created before rendering, even though the widget could render partially as each data source becomes ready. Using multiple DataSourceComponent instances is usually a better approach. A typical example is the Table widget, where each tab can be shown as soon as its data source is ready.
In the original question, there are only two data sources, and both are required for the join. In this case, using MultipleDataSourceComponent seems reasonable.