AnsweredAssumed Answered

Why is my grid undefined?

Question asked by kenbuja Champion on May 12, 2017
Latest reply on May 12, 2017 by kenbuja

In my widget, I'm creating a grid that will hold summary information on a feature layer. The grid is added to the widget, but the variable I have it assigned to is undefined. Where is my logic going wrong on this?

 

Here is where I'm initialize the variable names

    return declare([BaseWidget, _WidgetsInTemplateMixin], {

      baseClass: 'jimu-widget-spatialprioritization',
      name: 'Spatial Prioritization',
      _togSignin: null,
      _gridTotals: null,
      _layerSPGrid: null,
      _arrayTotals: null,
      _SPGridUrl: null,
      _rendererPriority: null,

 

and later on, here's where I instantiate the grid once the layer is loaded

 

      this._layerSPGrid.on("load", lang.hitch(this, function () {
        this._createTotalGrid();
      }));

      _createTotalGrid: function () {
        this._gridTotals = new Grid({
          id: 'gridPriority',
          columns: {
            priority: { label: "Priority", sortable: false },
            existing: { label: "Current", sortable: false },
            selected: { label: "Selected", sortable: false }
          },
          className: "gridpriority"
        }, this.totalGrid).startup();
        this._updateGridFeatures([]);
      },

 

The empty grid is added to the panel, but its reference is undefined. Why is that?

 

 

Outcomes