APEX 22. I have an interactive grid with a date and time column with a button to set the date and time to current date/time. The code for the button is in the javascript initialization code for the grid. See code below. This works well except in one scenario. If there was a value in the date and/or time fields and the user clears it and then uses the timestamp button, the values do not appear until you click in the fields. Any ideas for this behavior and is there anything that can be done? If it is a new record or there is a value in the fields the button works fine and displays the values as expected without having to click in the fields.
config.initActions = function(actions) {
actions.add([{
name: "row-timestamp",
label: "Timestamp",
icon: "fa fa-clock-o",
action: function(event, el) {
var g = apex.region('tasksIG').widget().interactiveGrid('getViews','grid');
var r = g.getSelectedRecords();
var ajaxRequest = new htmldb\_Get( null , $v('pFlowId') , 'APPLICATION\_PROCESS=get\_date' , $v('pFlowStepId'));
ajaxResult = ajaxRequest.get();
today = ajaxResult;
ajaxRequest = null;
var ajaxRequest = new htmldb\_Get( null , $v('pFlowId') , 'APPLICATION\_PROCESS=get\_time' , $v('pFlowStepId'));
ajaxResult = ajaxRequest.get();
time = ajaxResult;
var view = view = apex.region("tasksIG").call("getCurrentView"),
model = view.model,
detailKey = model.getFieldKey('TESTING\_EXEC\_DETAIL\_ID'),
detailID = view.getContextRecord(el)\[0\]\[detailKey\];
g.model.forEach(function(r) {
idCheck = g.model.getValue(r,'TESTING\_EXEC\_DETAIL\_ID');
if (idCheck == detailID){
g.model.setValue(r,'DATE\_OF\_EXECUTION',today);
g.model.setValue(r,'TIME\_OF\_EXECUTION',time);
};
});
}
}
\]);
};