Hi fellows,
I am trying to do (Provide and consume data sources in widgets) in my WAB Dev 2.6. I have Robert esearch widget 2.6 which is really great It does lot of things e.g filtering data and etc. Is it possible I can provide data from esearch widget and consume data in other widgets on my app which is described in widget help. Due to lack of programming capability I am confused in the getDataSources() function and this.updateDataSourceData(), how and where I will add in my widgets.
Any help is appreciated!
Irfan,
Here is some guidance:
define([
...
'jimu/DataSourceManager',
'jimu/utils',
...
],
function(
DataSourceManager, utils,
...
onDataSourceDataUpdate: function(dsId, data) {
if (!this.config.dataSource || dsId !== this.config.dataSource.frameWorkDsId) {
return;
}
data.features = utils.filterFeaturesByDataSourceSetting(data.features, this.config.dataSource, this.map);
this._onDataUpdate(data);
},
_onDataUpdate: function(data) {
var oldAttrs = array.map(this._features, function(f) {
return f.attributes;
});
var newAttrs = array.map(data.features, function(f) {
return f.attributes;
});
if(jimuUtils.isEqual(oldAttrs, newAttrs)){
return;
}
...
//do something with the data
},
...
Robert,
thank you seems like a small word for such a helpful person like you!
My apology I did not understand the whole thing due to insufficient programming skills, although I am trying to learn everyday.
My data-providing widget is eSearch widget and I want to consume the data in Near Me widget. In what file location and where I have to change the code above and how to get the dsId (data source Id). I wish I can understand!
Thanks again!
Irfan,
What in the eSearch results are you trying to use in the near me widget?
Yes.
Actually I was trying to add date filter in Near Me widget but that seems like not easy. I was reading the WAB help where I got that widgets can also provide and consume data. This seems like the feasible way, but I am not sure.I got the idea to get the data results from esearch widget because it have filtering option and then consume the results in the Near Me widget. Interesting thing is some of widgets are communication with each other. I mean they respect the data from other widget results. Like Near Me widget, Summary widget, and Filter widget.
Irfan,
So I am not very familiar with the Near Me widget. How would you use a date filter on it?
Robert,
Is it possible I can add just simple date/time filter in my app. I am not sure how hard it is, I have incidents data (more than 10000 records) which is increasing every day it is not easy to show all the data from years, hard to display, and app work very slow. When I use the Near Me widget It is really cool but it display all data within a buffer I can not filter. I am trying to find a way to add simple filter or query before doing other things on the app. So that user can filter data first.
User can start with the filtering of data with specific date/time then filtered data(results) can be used to other things in app. It is possible in filtering through Filter Widget but for that I have to display all data first on the map then i can use the filter widget to filter data. While in esearch widget don't need any data to display on map it can search and filter from data and then display. Thanks you!
Irfan,
That is a pretty big task for a beginner. It would take me some time to do even as an advanced developer.
Robert,
Thanks! Is it possible in filter widget to display data like esearch or query widget without turning data on from layer list.
Not that I know of.