@ZAFIRIS KERAMIDAS Yes, you are right, "this" should be accessible.
@El Mehdi ES-SAFI, you might be missing the variable mapping with the coach view from coach and possibly the variable is not initialized.
------------------------------
Atanu Roy
Solution Architect
Salient Process
------------------------------
Original Message:
Sent: Mon September 20, 2021 07:05 AM
From: ZAFIRIS KERAMIDAS
Subject: Binding data from view
Hi Atanu. No, you are not right. "this" is accessible fine inside the function...
------------------------------
ZAFIRIS KERAMIDAS
------------------------------
Original Message:
Sent: Mon September 20, 2021 05:27 AM
From: Atanu Roy
Subject: Binding data from view
Within the function, this is referring to the function itself not the coach view context.
Use this -
var _this = this;this.findUser = function () { var binding = _this.context.binding && _this.context.binding.get('value') || {}; console.log('username', binding.username);}
------------------------------
Atanu Roy
Solution Architect
Salient Process
Original Message:
Sent: Mon September 20, 2021 04:24 AM
From: El Mehdi ES-SAFI
Subject: Binding data from view
Hi Mrs Zafiris
Thank you for your time, unfortunately it doesn't work I still have undefined
------------------------------
El Mehdi ES-SAFI
Original Message:
Sent: Mon September 20, 2021 02:04 AM
From: ZAFIRIS KERAMIDAS
Subject: Binding data from view
You probably did not bind the "findUserByName" coach view with a variable (in the coach).
You can also write more defensive code so you avoid null pointer errors e.g.:
this.findUser = function () {
var binding = this.context.binding && this.context.binding.get('value') || {};
console.log('username', binding.username);
}
------------------------------
ZAFIRIS KERAMIDAS