Skip to Content
0
Former Member
Aug 11, 2015 at 01:36 PM

Problem AutoComplete Suggestion

275 Views

Dear Experts,

I have created one AutoComplete Object as follows

oCB_SO_LensType = new sap.ui.commons.AutoComplete({
  editable: true, 
     selectedItemId:null,
  width: '100%',
  tooltip: "Enter a name",
  maxPopupItems: 10,
  displaySecondaryValues: true,
  items:{
        path:"/E_MaraSet",
        template: new sap.ui.core.ListItem({key: "{Matnr}", text: "{Maktx}", additionalText: "{Matnr}"})
  },
     valueState : sap.ui.core.ValueState.Error,
     change: function(oEvent){
      searchItemCode = oEvent.getSource();
      if(searchItemCode.getSelectedKey()!=null){//GetVarientCode(searchItemCode.getKey()
      oCB_SO_LensType.setValueState(sap.ui.core.ValueState.Success);
      GetArticlePrice();
      oCB_SO_LensSide.focus();
      }else{
      oCB_SO_LensType.setValueState(sap.ui.core.ValueState.Error);
      oCB_SO_LensType.focus();
      }
     },
  });

and the filter as follows

oCB_SO_LensType.setFilterFunction(function(sValue, oItem){
  return (oItem.getText().toUpperCase().search(sValue.toUpperCase())!=-1 || oItem.getAdditionalText().search(sValue)!=-1); 


  });

on poppuing up the suggestion box if i select it through mouse it is giving me the object of combobox which i am using in change event but if select the suggested item using keyboard its not giving me combobox object it is empty i dont know how to handle this situation and i am stuck in it.

Kindly Advise

Rgards

:S