Query Builder - JavaScript error for fields with modal lookup

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
totza2010
User
Posts: 109

Query Builder - JavaScript error for fields with modal lookup

Post by totza2010 »

v2024.7

error only field is setting modal lookup.

ew.js?v=24.7.7:2611 Uncaught TypeError: Cannot read properties of undefined (reading 'lookupOptions')

<Field FldName="CompanyID" FldType="129" FldTypeName="char" NativeDataType="254" FldSupport="1" FldSize="26" FldReq="1" FldAttribute="4" FldRequired="1" FldGenerate="1" FldList="1" FldExport="1" FldView="1" FldEdit="1" FldAdd="1" FldAddOpt="1" FldSearch="1" FldBasicSearch="1" FldSrchOpr="USER SELECT" FldCaption="Company ID" FldViewTag="FORMATTED TEXT" FldHtmlTag="SELECT" FldTagSize="30" FldTagMaxLength="26" FldSelectType="Table" FldTagLnkTbl="company" FldTagLnkFld="CompanyID" FldTagLnkDisplay="CompanyCode" FldTagLnkDisp2="CompanyName" FldTagLnkDisp3="CompanyBranchNo" FldTagAPrefix="None" FldIncLeadDigit="-2" FldUseParen="-2" FldGpDigits="-2" FldSelectAllowAdd="1" FldQuoteS="'" FldQuoteE="'" FldColumnWrap="0" FldMultiUpdate="1" FldEditCustomAttributes="currentPageID() == &quot;edit&quot; ? &quot;readonly&quot; : &quot;&quot;" FldResizeQuality="75" FldModalLookup="1" />

ew.js?v=24.7.7:2611  Uncaught TypeError: Cannot read properties of undefined (reading 'lookupOptions')
    at AjaxLookup.get (ew.js?v=24.7.7:2611:26)
    at Object.createModalLookup (ew.js?v=24.7.7:3821:29)
    at <anonymous>:10:8
    at executeCallbacks (ewcore.js?v=24.7.7:93:98)
    at ewcore.js?v=24.7.7:260:7
    at fn (ewcore.js?v=24.7.7:38:24)
    at subscribe (ewcore.js?v=24.7.7:48:9)
    at Function.ready (ewcore.js?v=24.7.7:258:5)
    at <anonymous>:2:8
    at addScript (ew.js?v=24.7.7:6670:26)
get @ ew.js?v=24.7.7:2611
createModalLookup @ ew.js?v=24.7.7:3821
(anonymous) @ VM93498:10

when click (anonymous) @ VM93498:10 to show

loadjs.ready("finboundsearch", function() {
    var options = { name: "x_CompanyID", selectId: "finboundsearch_x_CompanyID" };
    if (finboundsearch.lists.CompanyID?.lookupOptions.length) {
        options.data = { id: "x_CompanyID", form: "finboundsearch" };
    } else {
        options.ajax = { id: "x_CompanyID", form: "finboundsearch", limit: ew.LOOKUP_PAGE_SIZE };
    }
    options = Object.assign({}, ew.modalLookupOptions, options, ew.vars.tables.inbound.fields.CompanyID.modalLookupOptions);
    ew.createModalLookup(options);
});

when click ew.js?v=24.7.7:2611 to show:


return this.list.lookupOptions;

in

    /**
     * Convert options to Select2 data format
     * @param {Object[]} options Options
     * @returns {Object[]}
     */;
    _proto.toSelect2Data = function toSelect2Data(options) {
      if (Array.isArray(options)) {
        if (options.every(item => item.hasOwnProperty("gf"))) {
          // Has group by field
          let groups = [...new Set(options.map(item => item.gf))];
          return groups.map(group => {
            return {
              text: group,
              children: options.filter(item => item.gf == group).map(item => {
                return {
                  id: item.lf,
                  text: this.formatResult({
                    lf: item.lf,
                    df: item.df,
                    df2: item.df2,
                    df3: item.df3,
                    df4: item.df4
                  })
                };
              })
            };
          });
        } else {
          return options.map(item => {
            return {
              id: item.lf,
              text: this.formatResult({
                lf: item.lf,
                df: item.df,
                df2: item.df2,
                df3: item.df3,
                df4: item.df4
              })
            };
          });
        }
      }
      return options;
    };
    _createClass(AjaxLookup, [{
      key: "isAutoSuggest",
      get: function () {
        var _this$_isAutoSuggest;
        (_this$_isAutoSuggest = this._isAutoSuggest) != null ? _this$_isAutoSuggest : this._isAutoSuggest = ew.isAutoSuggest(this.element);
        return this._isAutoSuggest;
      }

      /**
       * Lookup options
       */
    }, {
      key: "options",
      get: function () {
        return this.list.lookupOptions;
      }
    }]);
    return AjaxLookup;
  }();

arbei
User
Posts: 9384

Post by arbei »

I cannot reproduce. If you are a registered user of v2024, you better send your project file and database to support for testing.


Post Reply