I am calling one function from another function but it is "undefined". What cause this problem in TypeScript?
export class CariComponent implements OnInit {
satisSorumlusuId: number;
constructor(private dataService: DataService) { }
setCellValue (newData, value, currentRowData) {
console.log(this.getSatisSorumlusuId); // it prints undefined. So I cannot call this function here.
}
getSatisSorumlusuId(): number {
return this.satisSorumlusuId;
};
ngOnInit() {
}
}
UPDATE
setCellValue (newData, value, currentRowData)
function is DevExtreme function which I am using as third party product. This is how I set setCellValue.
<dxi-column
dataField="satisSorumlusu_Idstr"
caption="satisSorumlusu_Idstr"
[setCellValue]="setCellValue" >
<dxo-lookup
[dataSource]="satisSorumlusuDataSource"
valueExpr="id"
displayExpr="ismi">
</dxo-lookup>
</dxi-column>
If I make console.log(this)
in setCellValue function, it contains only DevExtreme related properties ( You can see at the bottom ). I mean there is no way to hook getSatisSorumlusuId()
if you go with this
. But how about that? What is the way to access properties and methods of Component ts file where actually everything is happening within it.
headerId: "dx-col-7"
visible: true
showInColumnChooser: true
allowFixing: false
allowReordering: false
autoExpandGroup: true
allowCollapsing: true
allowGrouping: false
allowFiltering: true
allowHiding: true
allowSorting: true
allowEditing: true
encodeHtml: true
trueText: "true"
falseText: "false"
allowExporting: true
caption: "satisSorumlusu_Idstr"
calculateCellValue: ƒ (data, skipDeserialization)
setCellValue: ƒ setCellValue(newData, value, currentRowData)
parseValue: ƒ (text)
calculateFilterExpression: ƒ ()
createFilterExpression: ƒ (filterValue)
lookup: {dataSource: inheritor, displayExpr: "ismi", calculateCellValue: ƒ, updateValueMap: ƒ, update: ƒ, …}
resizedCallbacks: Callback {_options: {…}, _list: Array(0), _queue: Array(0), _firing: false, _fired: false, …}
defaultCalculateCellValue: ƒ (data, skipDeserialization)
defaultSetCellValue: ƒ (data, value)
defaultParseValue: ƒ (text)
defaultCalculateFilterExpression: ƒ ()
defaultCreateFilterExpression: ƒ (filterValue)
dataField: "satisSorumlusu_Idstr"
selector: ƒ (data)
filterOperations: []
visibleIndex: 2
dataType: "string"
index: 2
alignment: "left"
defaultFilterOperations: []
defaultFilterOperation: "="
showEditorAlways: false
bestFitWidth: 177