Trying to get the new Search running against a feature layer. enableSuggestions and enableSuggestionsMenu are false. Don't see anything else in docs which warns of 10.3/supportsPagination = true.
Any help appreciated.
sources: [{ featureLayer: new FeatureLayer('.../Parcels/FeatureServer/0', { outFields: ['*'] }), searchFields: ['ADDRESS', 'PARCEL_ID', 'OWNER'], displayField: 'ADDRESS', exactMatch: false, outFields: ['*'], name: 'Parcels', placeholder: 'Search parcels', enableSuggestions: false, enableSuggestionsMenu: false, minCharacters: 3 }]
Solved! Go to Solution.
There is currently a bug with the search widget that requires services to support pagination. This bug will be fixed for the next release. You can workaround it in your application by setting maxResults to a string if the layer doesn't support pagination. Here's some code that shows how that might work.
//workaround to handle bug with pagination remove at 3.14 array.forEach(defaultSources, lang.hitch(this, function (s) { var paging = this._supportsPagination(s); if (!paging) { s.maxResults = "foo"; } })); _supportsPagination: function (source) { // check if featurelayer supports pagination remove at 3.14 var supported; if (source.locator) { supported = true; } else if (source.featureLayer) { // supports pagination if (source.featureLayer.advancedQueryCapabilities && source.featureLayer.advancedQueryCapabilities.supportsPagination) { supported = true; } } return supported; }
I also noticed that the Search multiple sources widget only works for the featureServer type. I tried to search through featureLayer of type ...MapServer/0 and got the pagination error as below...
There is currently a bug with the search widget that requires services to support pagination. This bug will be fixed for the next release. You can workaround it in your application by setting maxResults to a string if the layer doesn't support pagination. Here's some code that shows how that might work.
//workaround to handle bug with pagination remove at 3.14 array.forEach(defaultSources, lang.hitch(this, function (s) { var paging = this._supportsPagination(s); if (!paging) { s.maxResults = "foo"; } })); _supportsPagination: function (source) { // check if featurelayer supports pagination remove at 3.14 var supported; if (source.locator) { supported = true; } else if (source.featureLayer) { // supports pagination if (source.featureLayer.advancedQueryCapabilities && source.featureLayer.advancedQueryCapabilities.supportsPagination) { supported = true; } } return supported; }
Thanks Kelly Hutchins
Time frame on next release?
Sorry Ben I don't have specifics on a time frame. Julyish?
Thanks...trying to determine whether to wait or hack. 🙂
Thanks Kelly, that workaround stopped the error for me.
However, it should be noted that it appears that suggestions will not be enabled for sources that do not support pagination.
Tom Wayson correct suggest is only available if you are working with a 10.3 geocoding service that has suggest capability or a 10.3 feature layer that supports pagination.
Kelly Hutchins AGS 10.3 up and running. 10.3 DBS on it's way. Can't wait! Thanks for all your work!
Kelly Hutchins, is there a way to enable suggestions also for Layers not supporting pagination? Thanks