AnsweredAssumed Answered

Search Widget Order by

Question asked by beta6217 on Mar 1, 2019
Latest reply on Mar 2, 2020 by S.h.a.n.e

Hi,

I want to sort the search result(SuggestResult) with the Api 4 and the  "esri/widgets/Search "!

The featureservice allows you to sort:

 

The Advanced Query Capabilities:

      Supports Statistics: true

 

The standard sort is the objectid!

Where do I specify orderByFields: ["key","hsn","hsn_zusatz"]?

 

    var searchWidget = new Search({
        view: view,
        allPlaceholder: "Search for",
        searchAllEnabled: false,
        includeDefaultSources: false,
        sources:[{
                  featureLayer:{
                      url:"XXX/Search_HSN/FeatureServer/1",
                      popupTemplate: {
                          title: "Adresse: {strasse_hsn}",
                          overwriteActions: false,
                      },
                      },
                 //orderByFields: ["key_alb","hsn","hsn_zusatz"], ?????? where
                  searchFields: ["strasse_hsn"],
                  displayField: "strasse_hsn",
                  outfields: ["*"],
                  exactMatch: false,
                  name: "Street & number.",
                  placeholder: "Search for",
                  minSuggestCharacters: 0,
                  suggestionsEnabled: true,
                  maxSuggestions: 20,
                  resultSymbol: {
                                    type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
                                    style: "circle",
                                    color: [161,14,210,0.5],
                                    size: "20px",  // pixels
                                    outline: {  // autocasts as new SimpleLineSymbol()
                                    color: [161,14,210,0.5],
                                    width: 1  // points
                                    }
                                  }
                },

Outcomes