0

I am trying to incorporate Tim McGee's attribute table and search widgets into my existing CMV site. This is what I have done so far:

  • The search tool is in my TOC
  • The bottom pane is configured for table
  • I added a query to display upon opening, just to test the table, and the results of the query DO display in the table
  • I added a query based on my operational layer in the searchWidget.js and I see the query in my Search tool

When I click “Search” or set up a query by shape, though, nothing is happening. I have only edited the viewer and searchWidget js files.

Can anyone steer me in the right direction?

1

When I have had this kind of problem in the past, I look in the browser developer tools to see that the request is being sent, and what is being requested. I then use the request to test directly against the rest endpoint. I.e. at https://myserver.com/arcgis/rest/services/MyService/MapServer/4/query

Usually, when I get no response it is because of field naming, especially where joins are involved.

I have just re-read you question and see that you do manage to see results (I will leave my response as it may be useful to others). Is the request being sent when you click search? Is your query returning geometry?

| improve this answer | |
  • I agree with tr3v's approach. If you do not see any requests being sent to the server, the options for the search widget would need be be examined to see what is missing. Compare the options for the search widget to those in the query that does work when put in the the attributes table widget options. – tmcgee Mar 30 '15 at 23:52
  • I appreciate your help. When I click on the "Search" tool in the attribute tab, I am not seeing anything in the browser developer tools console and nothing in ArcGIS Server Manager. It does, however, clear the table, which is populated by a query when the site opens (query configured in viewer.js). When I click on the "by shape" tab and try to select by shape, the following shows in the console (see below) – slowe Mar 31 '15 at 13:51
  • GET http://<MYSERVER>/MYMAP/widgets/Search/css/fonts/draw-icons.woff init.js:141 k.getPadExtentsinit.js:142 k.getPadBorderExtentsinit.js:145 k.setMarginBox_ContentPaneResizeMixin.js:4 h._layout_ContentPaneResizeMixin.js:4 h._scheduleLayout_ContentPaneResizeMixin.js:3 h.resizeStackContainer.js:7 e._transitionStackContainer.js:6 e.selectChildinit.js:106 n_TabContainerBase.js:7 e.selectChildStackController.js:8 h.onButtonClickStackController.js:5 (anonymous function)init.js:177 g.hitch – slowe Mar 31 '15 at 13:53
  • Looks like something is broken in the original code, seem the search is not firing. Maybe something to do with the first query leaving the search widget in an inconsistent state? Assuming you have the most recent version of CMV (1.3.3 I think?), I would go back to a working search widget and try your query from there. Sorry I cannot be more helpful at this stage. – tr3v Mar 31 '15 at 19:44
  • Thanks. I will do that. I know my question was a bit vague, as I am new to JavaScript, so please do not apologize for not being more helpful. I so much appreciate the suggestions. – slowe Apr 2 '15 at 14:45
0

I would like to add to tr3v's statement about field naming. I had my Search results working (able to zoom to the features, the features were displaying on the map) and there were rows added to my attribute table--but I could not figure out why the rows were blank. Turns out I learned the hard way that field naming is case sensitive. I had the field and the label spelled correctly but the field should not have been in all uppercase, the corrected code is below:

                    title: 'InfoUSA',
                    topicID: 'infousaQuery',
                    gridOptions: {
                        columns: [

                            {
                                field: 'Company_Name',
                                label: 'COMPANY_NAME',
                                width: 150
                            }
                        ],
| improve this answer | |
  • Case-sensitivity with field names is a common stumbling block when working with the ArcGIS JS API and working with JSON in general. Sorry, I can help you regain those lost hours! ;) – tmcgee Apr 15 '15 at 18:27

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.