Skip to Content

How to access control model from 'blur' browser event

Hello Experts,

I have a textField column in a table.

I need to listen to the 'blur' event of each textField cell.

I use the following code:

<textField>.attachBrowserEvent("blur", onBlur);

The code works and I can get the textField's value (by using this.getLiveValue()).

However, I need to get other property from the model (from the same row).

How can I get the model from the 'blur' function? (get the exact row properties)

I can always add a hidden column and use jQuery sibling etc to get the value but I'm sure there is more elegant way (-:

Regards,

Omri

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 07, 2015 at 12:55 PM
      .....attachBrowserEvent("blur", function(e) {  
      var oInput = sap.ui.getCore().byId(e.currentTarget.id);
        var sPath = oInput .getBindingContext().sPath;
    }
    

    In the variable sPath is now the path to the current row.

    Hope it helps.

    If not working, please read this: Asking for coding help - SAPUI5 - (please read before posting coding questions)

    kind regards, Kai

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Kai Helferich

      Not that I'm aware of. Note that a control can have multiple binding contexts, potentially one for each model that it has access to. Considering that, there cannot really be any logic to get *the* binding context. Anyhow, you should always know the model name or reconsider your design 😉

      - Max