In my JavaScript code, I would like to dynamically pass the ID in self.fetch_table_data("10") from the selectedEmployeeId obtained in the _onEmployeeChange function. How can I achieve this in the willStart function?
willStart: function() {
var self = this;
return $.when(this._super()).then(function() {
return self.fetch_data(), self.fetch_table_data("10");
});
},
_onEmployeeChange: function (event) {
var selectedEmployeeId = document.getElementById("resource_title").value;
this.fetch_table_data(selectedEmployeeId);
},
fetch_table_data: function(employee_id) {
var self = this;
var def2 = this._rpc({
model: 'project.project',
method: 'get_table_data',
args: [employee_id, ],
}).then(function(result1) {
self.resource_data = result1['table_data']
console.log(self.resource_data, "success")
self.drawGanttChart(self.resource_data)
});
return $.when(def2);
},