Ich befolge die Dokumentation here, um ein Kontextmenüelement zu meinem Grid hinzuzufügen. Das Problem ist, dass ich aus dem Bereich von getContextMenuItems (im Beispiel) nicht auf andere Methoden oder Variablen in meiner Komponente zugreifen kann. Ist das möglich? Beispiel unten:Probleme bei der Skalierung bei der Verwendung des Kontextmenüs
private varIWantToAccess: boolean = false;
function getContextMenuItems(params) {
var result = [
{ // custom item
name: 'Alert ' + params.value,
action: function()
{
window.alert('Alerting about ' + params.value);
this.varIWantToAccess = true; // Builds fine, but throws a run time exception, since this "this" context is different than the one that has "varIWantToAccess"
}
},
....
return result;
}
Vielen Dank!
Das ist nicht wirklich auf ag-Raster verwendet ist. Ähnliche Ausgabe: [Angular 5/4/2 Methode als Referenz übergeben ist nicht im Anwendungsbereich] (https://stackoverflow.com/questions/48557364/1417185) – Paritosh
Mögliche Duplikat von [Angular 5/4/2 Methode als Referenz übergeben wird nicht im Umfang] (https://stackoverflow.com/questions/48557364/angular-5-4-2-method-passed-as-reference-is-not-in-scope) – Paritosh