There is a method that accepts JSON data. Based on this data, points are created and added to the graphics layer. How to implement search in a graphics layer? I found an example of how to implement search in FeatureLayer (sample)! How to do the same in GraphicsLayer?

A method that draws the JSON points:

function draw_point_layer(stations, list_name_net) {
                for (i = 0; i < stations.length; i++) {
                    var point = {
                        type: "point", // autocasts as new Point()
                        longitude: stations[i]['longitude'],
                        latitude: stations[i]['latitude']
                    var pointAtt = {
                        Code: stations[i]['sitecode'],
                        Name: "<a href='" + stations[i]['link'] + "'>" + stations[i]['name'] + "</a>",
                        Type: stations[i]['type'],
                        Nets: list_name_net[i]
                    var pointGraphic = new Graphic({
                        geometry: point,
                        symbol: markerSymbol,
                        attributes: pointAtt,
                        popupTemplate: {
                            content: [{
                                type: "fields",
                                fieldInfos: [
                                        fieldName: "Code",
                                        label: 'Код',
                                        fieldName: "Name",
                                        label: 'Имя',
                                        fieldName: "Type",
                                        label: 'Тип',
                                        fieldName: "Nets",
                                        label: 'Сети',

From the search documentation:
"The Search widget provides a way to perform search operations on locator service(s) and/or map/feature service feature layer(s)"
"Feature layers created from client-side graphics are not supported."
Based on the doc, it seems that the Search widget can't be used for graphics layers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.