An event handler will be called later when you exit the extension. It is called in the scope of the element, so this will be the changed element.
Copy the link to the list to a local variable and use it in the event handler:
var list = this.materialListResponse; this.updateDetails = function() { for (i = 0; i < list.length; i++) { if (list[i].MaterialCode === this.val()) { $('#table1 #MaterialDescription').val(list[i].Description); } } }
Using a local variable in a function, the variable will be part of the closure for this function, so it will survive in the extension method area where it is declared.
Guffa source share