Attribute Table Query

673
6
05-15-2020 12:11 PM
LefterisKoumis
Occasional Contributor III

Looking  for ways to pass on a filter expression from a widget to the Attribute Table to update the AT display based on the query, rather than opening another tab.

The table displayed in the AT  is not the attribute table from the layer, but they share a unique id.

Perhaps perform the query at the widget, then close the AT and open it with the results you pass on from the widget query?

Thank you.

0 Kudos
6 Replies
LefterisKoumis
Occasional Contributor III

Thank you Robert.

I tried applying this 

            var partsObj = {
              "expr": the_expression,
              "parts": []
            };

            this.wManager = WidgetManager.getInstance();
            if (this.wManager) {
              var widgetCfg = this._getWidgetConfig('AttributeTable');
              if (widgetCfg) {
                var attWidget = this.wManager.getWidgetByLabel(widgetCfg.label);
                var activeTable = attWidget._tableFunctionController.getActiveTable();
                activeTable.setFilterObj(partsObj);
                activeTable.refresh();
              }
            }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

But I get this error.

The attWidget is not null.

UPDATE:

I turned on the visibility for a feature layer on the AT and it works.

The other table that I was trying to apply the filter on is actually a non-spatial table from web service.

I guess the filter is not working for tables in AT?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I am pretty sure no spatial tables do not work in AT Widget.

0 Kudos
LefterisKoumis
Occasional Contributor III

If I apply the filter on the non-spatial table, it displays the results. Could we call the filter programmatically on this table.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Don't know.

0 Kudos
LefterisKoumis
Occasional Contributor III

It seems it can be done. I am posting in case someone else, want to query a non-spatial table in the AT:

for example:

        the_expession = "UPPER(<field>) LIKE '%<something>%'"

      
      var partsObj = {
        "expr": the_expession,
        "parts": []
      };
      this.setFilterObj(partsObj);
      this.clearSelection(false);
      this.startQuery();
      
      this.emit('apply-filter', {
        layerInfoId: layerInfo.id,
        expr: partsObj.expr
      });