Skip to Content
author's profile photo Former Member
Former Member

Auto complete change to bold

I use the following control and I wonder if there is a way that if user for example type aaa and this is

part of the auto complete put this aaa in bold

e.g.

user have this option

aaa/bb/ccc

and the user type aaa so he get aaa/bb/ccc

if he type cc you get aaa/bb/ccc

is it possible?

AutoComplete - SAPUI5 Demo Kit

Title Typo edited by: Michael Appleby

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2015 at 07:27 AM

    Hi Stephane,

    First know the id of the listBox of autocomplete by doing inspect element(right click on the listbox of the autocomplete and click inspect element). And then try with the following code: that is by using liveChange event

    createContent : function(oController) {
    
    
    
      //Initialize a JSON Model
    
      var oModel2 = new sap.ui.model.json.JSONModel();
      oModel2.setData(aData);
      //Create a AutoComplete control and bind the items aggregation
      var oAuto2 = new sap.ui.commons.AutoComplete("auto1",{
      tooltip: "Enter a name",
    
    
      maxPopupItems: 5,
      displaySecondaryValues: true,
    
      items: {
      path: "/",
      template: new sap.ui.core.ListItem({text: "{name}", additionalText: "{userid}"})
       
      },
      liveChange: function()
      {
      document.getElementById("auto1-lb-list").style.fontWeight = "bold";
    
     });
    
      oAuto2.setModel(oModel2);
      //attach it to some element in the page
      oAuto2.placeAt("content");
      }
    
    
    });
    

    Hope this helps😊

    Regards,

    Lahari

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 23, 2015 at 08:49 PM

    you would need to extend sap.ui.commons.ListBox

    no such functionality out of the box

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.