Select to view content in your preferred language

Problem with Attribute Inspector in 3.1

1039
7
09-17-2012 06:51 AM
ReneeMaxwell
Regular Contributor
I have an editing application built on JSAPI version 3.1 and it includes a couple of Attribute Inspectors for 2 featureLayers in the app. One of them started giving me trouble when I select a record from a search result in a datagrid and I'm not sure why, but now the Attribute Inspector will not load at any time a feature from the associated layer is selected.

The only error I receive is:
"TypeError: _38a.toLowerCase is not a function" Editor-all.js (line 19)

I have another Attribute Inspector which loads when a feature is selected from a different Feature Layer and that one works fine.

I can see that the feature has been properly selected in the JSON response in Firebug. The query is working properly, but I am unable to view the attributes in the Attribute Inspector.

I created a function which fires 'onSelectionComplete' for this layer to see if that would give me any clues. The function is triggered but the code does not run.
0 Kudos
7 Replies
ReneeMaxwell
Regular Contributor
To make things more interesting, the Attribute Inspector works perfectly fine if the selection is fired by the the identify task, until the user tries to select a record from the datagrid which lists search results. Once a feature is selected from the datagrid the Attribute Inspector throws an error every time, regardless of how a feature is selected.

Regardless of which function calls the feature selection, it is always fired via the featurelayer.selectFeatures(query) method. It is my understanding that the Attribute Inspector should be triggered any time a feature is selected in the associated layer. For some reason it only works part of the time.

FYI, I did not encounter this problem in version 2.8.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Can you provide a test case that shows the problem?
0 Kudos
ReneeMaxwell
Regular Contributor
Kelly,

Thanks for your reply. I'm afraid I cannot provide a test case, as it is a restricted site due to the data editing capabilities. Here are some screen shots that illustrate the problem.

When the Attribute Inspector loads correctly, it looks like this:
[ATTACH=CONFIG]17763[/ATTACH]

When it does not load on the first try, it looks likes this:
[ATTACH=CONFIG]17764[/ATTACH]

After the first error is thrown, all subsequent selections load just the first attribute field:
[ATTACH=CONFIG]17765[/ATTACH]

You can see in the Firebug console that the feature has been properly selected and the result returned.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Sorry I haven't seen this issue before and without seeing the code (or a test case that repros) it is hard to know what is going on. Can you repro with any of the sample data?
0 Kudos
ReneeMaxwell
Regular Contributor
OK, I'll break down the relevant code. First a feature is selected on the map.

var selquery = new esri.tasks.Query();
selquery.where = "OBJECTID = " + featID;
var geoLyr = map.getLayer(layerId);
geoLyr.selectFeatures(selquery);


In the init() function, each feature layer is connected to an 'onSelectionComplete' function:

dojo.connect(geoLyr, "onSelectionComplete", selectFeature);


Once a feature has been selected, then we query a business table (also a feature layer loaded in the map) to select the associated record:

function selectFeature(geoResults) {
    if (geoResults.length === 1) {
        var accNum = geoResults[0].attributes["ACCNUM"];
        var accTbl = map.getLayer("accTable"); // ACCESSIONS table feature layer

        var accQuery = new esri.tasks.Query();
        accQuery.returnGeometry = false;
        accQuery.where = "ACCESSIONNUMBER = '" + accNum + "'";
        accTbl.selectFeatures(accQuery, esri.layers.FeatureLayer.SELECTION_NEW);
    }
}


That's really it. The selectFeature function fires every time any single feature is selected on the map. When the Identify task is used to select a feature, the Accessions table selection works as expected and the Attribute table loads correctly.

When a feature is selected via the datagrid onRowClickHandler function, the same selectFeature function also fires, but you get the error as shown in the screenshots above UNLESS it has already been displayed by a previous Identify selection.

To clarify, if a user selects a feature first using the Identify task, the Attribute Inspector will load the selected feature from the Accessions table correctly, and it will continue to work correctly if the user selects a search result from the datagrid. However, if a user makes their first selection from the datagrid, the Attribute Inspector will fail to load the selected record on all subsequent selections, regardless of the method used.

I find it strange and baffling that the same 'onSelectionComplete' function, which returns the correct feature every time, only loads the Attribute Inspector some of the time.
0 Kudos
ReneeMaxwell
Regular Contributor
I've tried this in 3.2 and I am encountering the same problem with the Attribute Inspector. It fails on most (but not all) feature selection operations, despite the fact that the correct features have been properly selected. The attribute inspector will not load. The same error occurs in all feature layers: "TypeError: _38a.toLowerCase is not a function" Editor-all.js (line 19)

I'd really love to know how to fix this. I'm updating an existing editing application and the ability to select features and edit attributes is critical.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Have you tried creating a test case with Esri sample data to see if you can repro the issue? Having a test case we can use from troubleshooting would help to identify the issue with your app.
0 Kudos