2

I have an AttributeTable that I have opening when I start a widget. When I click on a table row in this instance, I am able to get the information back correctly and not see this message. I did this by changing the config.json file to have the primary field in the database to not show.

"name": "Current Parties",
"id": "Layer Id",
"layer":{
    "url": "url to Feature Server",
    "fields":[
        {
            "show": false,
            "name": "OBJECTID",
            "alias": "OBJECTID"
        }
    ]
}

With the rest of the fields having the property set to true. However, when I change the table and have it pulling back from a different database, I see the correct information, but when I click on a record in the table, I get this alert

enter image description here

Which should not be appearing since the new information is being displayed in exactly the same way. Can anyone explain why this alert is still showing up? If anything else needs to be added to better help diagnose the problem, let me know and I'll add it.

0

After many tedious and failed attempts at trying to figure this out, I finally got it figured out. Since the AttributeTable is an off panel widget, it is opened in a different way than on panel widgets. Inside the AttributeTable widget.js file, the open method invokes this._openTable(). Since my custom widget.js file also contains the open function, I simply needed to find the off panel widget I wanted to open and invoke the panel._openTable() method each time I wanted the AttributeTable to open and load the correct information. So in the end, here's what I did.

In the open function in my custom widget file, I created a reference to my WidgetManager instance.

var wm = WidgetManager.getInstance();

I then got the reference and located the AttributeTable widget in the loaded object array. At which point, I attached the _openTable() method to it.

wm.loaded[8]._openTable();

This loaded every layer and field with a property of true in the config.json file(I did some customization to hide and show certain tables each time I opened the table, but that's not pertinent to this question). Since everything has been pre-loaded, I could close the table and re-open it and change which tables were showing in the AttributeTable widget.js file's onReceiveData function. When it received the message that I had re-opened the widget, it knew which fields to show based on the customization I mentioned earlier.

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.