Error in FeatureTable, generating column headers

5073
16
Jump to solution
05-20-2016 01:21 PM
TracySchloss
Frequent Contributor

I am using FeatureTable for the first time, attempting to use it instead of dGrid (just for fun, you know).   My AGS server is still at 10.2.2.  I'm using version 3.16 of the API.

My featureLayer is defined as:

app.pointFLayer = new FeatureLayer (pathName+"/arcgis/rest/services/DHSS/mysecure/LayerMapServer/0", {
  id: "resFLayer",
  outFields: ["*"],
  opacity: 0.0
});

I have a load function on this layer to generate the table:

//populate the table in the footer

  app.pointFLayer.on ("load", function (fl) {
    myFeatureTable.initTable();
  });

Here's that function:

define([
"dojo/dom", 
"esri/dijit/FeatureTable"
], function(dom, FeatureTable){
    return {
        initTable: function(){
            app.Table = new FeatureTable({
                featureLayer: app.pointFLayer,
                map: app.map,
                dateOptions: {
                    datePattern: 'MMMM d, y'
                },
            //    outFields: ["Kit_Serial_Number", "Address", "City", "State", "Zip", "County", "Analysis_Date", "Final_Result", "Loc_Code"],
                fieldInfos: [{
                    name: 'Kit_Serial_Number',
                    alias: 'Kit Serial Number'
                }, {
                    name: 'Address',
                    alias: 'Address'
                }, {
                    name: 'City',
                    alias: 'City'
                }, {
                    name: 'State',
                    alias: 'State'
                }, {
                    name: 'Zip',
                    alias: 'ZIP'
                }, {
                    name: 'County',
                    alias: 'County'
                }, {
                    name: 'Analysis_Date',
                    alias: 'Analysis Date'
                }, {
                    name: 'Final_Result',
                    alias: 'Final Result'
                }, {
                    name: 'Loc_Code',
                    alias: 'Location Code'
                }]
            }, dom.byId('tableDiv'));
            app.Table.startup();
            return app.Table;
        }
    }
});

There are a lot of points in this layer, over 20K.  I know this isn't great, but it's what the users asked for.  I'm going to add some query capabilities that will eventually limit the results to something more reasonable.  In the meantime, this processes a while and eventually gives me this error: 

init.js:199 SyntaxError: Unexpected char ] in label.dgrid-hider-menu-label.hider-menu-label-0[for=[object HTMLDivElement]_grid-hider-menu-check-0](…) "SyntaxError: Unexpected char ] in label.dgrid-hider-menu-label.hider-menu-label-0[for=[object HTMLDivElement]_grid-hider-menu-check-0]

    at q (https://js.arcgis.com/3.16compact/put-selector/put.js:4:496)

    at r._renderHiderMenuEntry (https://js.arcgis.com/3.16compact/dgrid/extensions/ColumnHider.js:4:32)

    at r._renderHiderMenuEntries (https://js.arcgis.com/3.16compact/dgrid/extensions/ColumnHider.js:3:115)

    at r.renderHeader (https://js.arcgis.com/3.16compact/dgrid/extensions/ColumnHider.js:6:243)

    at m (https://js.arcgis.com/3.16compact/init.js:96:92)

    at A.renderHeader (https://js.arcgis.com/3.16compact/dgrid/extensions/ColumnResizer.js:6:363)

    at Object.h.around.advice (https://js.arcgis.com/3.16compact/init.js:234:254)

    at g.(anonymous function).h [as renderHeader] (https://js.arcgis.com/3.16compact/init.js:234:44)

    at h._updateColumns (https://js.arcgis.com/3.16compact/dgrid/Grid.js:13:215)

    at h._setColumns (https://js.arcgis.com/3.16compact/dgrid/Grid.js:12:340)

    ----------------------------------------

    rejected at a (https://js.arcgis.com/3.16compact/init.js:190:337)

    at k (https://js.arcgis.com/3.16compact/init.js:190:89)

    at q (https://js.arcgis.com/3.16compact/init.js:189:357)

    at resolve (https://js.arcgis.com/3.16compact/init.js:191:441)

    at https://js.arcgis.com/3.16compact/esri/dijit/FeatureTable.js:22:50

    at r._resolve (https://js.arcgis.com/3.16compact/esri/layers/FeatureLayer.js:159:236)

    at https://js.arcgis.com/3.16compact/esri/layers/FeatureLayer.js:162:498

    at c (https://js.arcgis.com/3.16compact/init.js:66:221)

    at d (https://js.arcgis.com/3.16compact/init.js:66:10)

    at resolve.callback (https://js.arcgis.com/3.16compact/init.js:67:350)

    ----------------------------------------

Error

    at then.b.then (https://js.arcgis.com/3.16compact/init.js:192:253)

    at D._queryFeatureLayerSetup (https://js.arcgis.com/3.16compact/esri/dijit/FeatureTable.js:22:231)

    at https://js.arcgis.com/3.16compact/init.js:167:296

    at c (https://js.arcgis.com/3.16compact/init.js:66:221)

    at d (https://js.arcgis.com/3.16compact/init.js:66:10)

    at resolve.callback (https://js.arcgis.com/3.16compact/init.js:67:350)

    at c (https://js.arcgis.com/3.16compact/init.js:66:436)

    at d (https://js.arcgis.com/3.16compact/init.js:66:10)

    at resolve.callback (https://js.arcgis.com/3.16compact/init.js:67:350)

    at Object.e._resDfd (https://js.arcgis.com/3.16compact/init.js:749:238)"

I've tried with the outFields defined and with them commented out.  There aren't any characters ] in my field names. The service is secure, but see my attachment for the field names for this layer.  Hopefully someone spots something I've missed. 

0 Kudos
1 Solution

Accepted Solutions
NicolásTomeo
New Contributor II

If you pass the dom node don't work. You should pass the id.

Besides you are using the 3.15 compact version of the api but the 3.16 version of the css. That causes troubles.

I recommend using the 3.16 version because i had problems with the feature table in 3.15.

Again, in ArcGIS API for JavaScript Sandbox if you put the css in 3.16 but the js in 3.15 it don't work. Also if you change all to 3.15 in the same example you will notice that the events don't work and you  will see a warning in the console.

View solution in original post

16 Replies
BillDaigle
Occasional Contributor III

I don't see anything right off the bat, but I seem to remember having a similar error the first time I implented featureTable.

A couple things to note, however.

  • I don't think you're declaration of dateOptions is going to have any effect since you are not allowing editing.  If you want the date column in your data to have a specific format, it should be listed with the fieldInfos for the date field.
  • featureTable is a dGrid, so you're not getting away from dGrid. 
0 Kudos
TracySchloss
Frequent Contributor

Yeah, I know it's built on dGrid, but it's not identical syntax.  It's just close enough to be confusing.  I took the lines out for formatting the date, but it didn't help. Same error as before. I also changed my aliases to not have an underscore, although that's not traditionally a problem.  I vaguely remember some issue mentioned specifically for a compact build that isn't in the full set. I switched from 3.16compact to 3.16, but that didn't change the error either.

I hoped to get this figured out, because it more closely aligns with how tables look in WAB.  I'm working toward a consistent look and feel.

0 Kudos
NicolásTomeo
New Contributor II

I am very new in Dojo and Esri but i have a similar problem with the Feature Table. What i have found out is that for example in the Feature Table SampleArcGIS API for JavaScript Sandbox   if you use dom.byId("myTableNode") instead of just "myTableNode"  to create the table you get the same error. In my opinion there's a problem with the use of the dom node object. And in my case i can't use the id beacuse i am instanciating the feature table inside a dijit  Dialog.

I hope this help you. In the mean time i keep researching.

Sorry for my bad english, it is not my mother language.

BillDaigle
Occasional Contributor III

Nicolas is right.  That is exactly the problem.  In my implementation, I ended up dynamically creating the domNode first and assigning it an id.

var tableNode = domConstruct.create('div', {
  id: this.id + '_detailsTable'
}, this.advisoriesContainer);

var hiddenFields = ['OBJECTID', 'GLOBALID', 'CL_GLOBALID'];

this.myTable = new fwpFeatureTableEditor({
  featureLayer: this.featureLayer2,
  editable: true,
  hiddenFields: hiddenFields,
  showGridMenu:false,
  gridOptions: {
    selectionMode:'single'
  }
}, tableNode.id);
NicolásTomeo
New Contributor II

Do you know if is there any way to put the Feature Table inside a dijit Dialog? Because i manage to do it with my own custom widgets, simply by instanciating them and then setting the content of the dialog as the widget itself but with the feature table this did not work for me.
Thank you!.

0 Kudos
BillDaigle
Occasional Contributor III

You might try placing an empty div (with a defined height and width) into the dialog first, then adding you feature table widget.  I find the feature table is sensitive to timing. 

NicolásTomeo
New Contributor II

Yes, it works!

0 Kudos
ChristopherJohnson1
Occasional Contributor II

Hi, Nicolas.  Do you mind sharing the code to get the FeatureTable to appear in the dialog, please?

Thanks...Chris

0 Kudos
TracySchloss
Frequent Contributor

I'm just not getting anywhere with this.  This is public facing: FeatureTable Example

It would be wonderful if someone could spot the likely dumb thing I'm missing.

0 Kudos