0

I have this code running fine in browser, but when I tried to run on the mobile browser, it didn't work. Any good suggestion?

    var oTextArea = this.getView().byId("selectConditionAS");

    oTextArea.attachBrowserEvent("keyup", debounce(function() {
        var searchkey = oTextArea.getValue();
        console.log(searchkey);
    }
user3736228
  • 273
  • 3
  • 18

1 Answers1

0

You don't need to use Browser events if you have SAPUI5 events which does the same. if you are using sap.m.TextArea or sap.ui.commons.TextField then you can use their liveChange event.

var oTextArea = this.getView().byId("selectConditionAS");

  oTextArea.attachLiveChange(function(oEvent){
   var searchkey = oEvent.getSource().getValue();
   console.log(searchkey)
  });

hope this helps.

5udip
  • 16
  • 1
  • Thanks. The problem is I want to detect when the user stop typing and execute the function after X milliseconds. Can I do that with the above code? – user3736228 Oct 07 '18 at 22:49
  • `attachLiveChange` triggers every keystroke, so you would use it exactly the way you would with the default browser method. – Jorg Oct 07 '18 at 23:06