cancel
Showing results for 
Search instead for 
Did you mean: 

Error in binding aggregation for "suggestionRows" (custom tabular suggestions of sap.m.Input)

Cmdd
Participant
0 Kudos

I am trying to extend a SmartField, in particular I need to create my custom tabular suggestions for the sap.m.Input embedded in the SmartField. However, when I try to bind the aggregations (suggestionRows and suggestionColumns) for the tabular suggestions this error shows up:

Uncaught Error: "Element sap.ui.core.Item#__item1-__input0-popup-table-0" is not valid for aggregation "items" of Element sap.m.Table#__input0-popup-table
    at f.h.validateAggregation (sap-ui-core.js:480)
    at f.h.addAggregation (sap-ui-core.js:485)
    at f.addItem (sap-ui-core.js:556)
    at u (sap-ui-core.js:513)
    at f.h.updateAggregation (sap-ui-core.js:513)
    at f.L.updateItems (ListBase.js:6)
    at f._oSuggestionTable.updateItems (Input.js:6)
    at constructor.m (sap-ui-core.js:511)
    at constructor.a.fireEvent (sap-ui-core.js:449)
    at constructor.B._fireChange (sap-ui-core.js:1280) 

Can someone point me in the right direction?
This is a snippet from my XML

<smartForm:GroupElement> 
<mynameSpace:MyCustomSmartComponent value="{value}"/>
</smartForm:GroupElement> 

and this is my control.js simplified code :
 sap.ui.define([
"sap/ui/comp/smartfield/SmartField"
], function(SmartField) {
"use strict";
return SmartField.extend("SmartfieldTest.controls. MyCustomSmartComponent  ", {
metadata: {
properties: {
   .....
}
},
renderer: {},
// private properties
this._innerControl;
...

// private methods redefinition
init: function() {
  SmartField.prototype.init.apply(this, arguments);
  this.setShowSuggestion(false);
  this.setShowValueHelp(false);
  this.attachInnerControlsCreated(this.onInnerControlCreated, this);
},

onInnerControlCreated: function(oEvent) {
  /* @type sap.m.Input */
  this._innerControl = this.getInnerControls()[0];
  this._innerControl.setShowSuggestion(true);
  this._innerControl.setShowValueHelp(false);

  this._innerControl.insertSuggestionColumn(new sap.m.Column({
    hAlign: "Begin",
    header: new sap.m.Label({
    text: "Col1"
    })
   })
  );

  this._innerControl.insertSuggestionColumn(new sap.m.Column({
    hAlign: "Begin",
    header: new sap.m.Label({
    text: "Col2"
    })
   })
  );

 this._innerControl.insertSuggestionColumn(new sap.m.Column({
   hAlign: "Begin",
   header: new sap.m.Label({
   text: "Col3"
   })
  })
 );

  this._innerControl.insertSuggestionColumn(new sap.m.Column({
    hAlign: "Begin",
    header: new sap.m.Label({
    text: "Col4"
    })
   })
  );

  var oTableItemTemplate = new sap.m.ColumnListItem({
    type : "Active",
    vAlign : "Middle",
    cells : [
     new sap.m.Label({
      text : "{ Property1 }"
     }),
     new sap.m.Label({
      text: "{ Property2 }",
      wrapping : true
     }), 
     new sap.m.Label({
      text: "{ Property3 }"
     }), 
     new sap.m.Label({
      text : "{ Property4 }"
     })
    ]
  });

this._innerControl.bindAggregation("suggestionRows", "/SuggestionEntitySet", oTableItemTemplate);
 }});
}); //end of onInnerControlCreated method

<br>
View Entire Topic
Cmdd
Participant
0 Kudos

I just answered myself.... it's a matter of SAPUI5 version.

With 1.38.31 no chance to have it working..... Upgrading to 1.54 it works perfectly.