Is it possible to display the first couple of days of calls for service so that my users can see the last 48hrs by default? Then if they wanted to see something prior to that they can search for it using the filter. Currently, my users have to put in a date filter every time they open the application.
Rudo,
I need to see your config_Calls for Service Search.json as well. Obviously I don't have access to
http://phqgis01:6080/arcgis/rest/services/CallsForServiceWeb/MapServer/0 so I changed the url and fields to use one of esri sample services and I was able to get this working in your widget.
Like I said, I had to change to a different layer and expression, fields, etc, and of course remove the code from the _removeResultItem function. I think it has something to do with the configuration of your search layer. Is the only thing that layer one expression one have is a date range? This is why I need to see your json.
I have attached the config_Calls for Service Search.json and the widget is using one layer, that has 12 different filter options. The date range is the very last one?
Rudo,
So that is the issue the code is only setup to provide data for one entry (one expression value). I only knew about your need to search for the last 48 hours not 11 other criteria in addition to the last 48 hours.
That's my mistake, I guess I thought that I could make it ignore the other criteria when the widget is clicked on and automatically open up the last 48 hours as a default. After the defaults are opened, I thought I would be able to go through my regular filter options and select what filters I want to display, if I wanted to see something more specific. My apologies Robert.
Rudo,
So you could setup a second expression that only uses the date range then, and the use:
this._queryFromURL(startTime + "~" + endTime, 0, 1, false);
Or you could move the date range expression to the very first expression value instead of the last one.
Could I use this?
this._queryFromURL(startTime + "~" + endTime, 0, 11, false);
Will that make it look at the 12 fields (i.e. date range field)?
Rudo,
No you are confusing expression values with expressions. When you configure a search layer you can have multiple expressions (or one as you have) and each expression can have multiple expression values (like you 12 expression values). The _queryFromURL function takes the parameters of search value, search layer #, expression #, close widget.
So I have to put my date range at the top of my filter list for it to work?