I have a shortcut (let’s say F10) bound to a global method (plugins.window.createShortcut(‘F10’, globals.shortcut_handler)).
The problem is that when I am editing a field on the form and hit F10 the dataprovider value of that form element is not updated until the UI focus changes to another element.
How can I force the dataprovider value update in code ? I’ve tried focusField and requestFocus to another field but it all does not do the update in code…
Any ideas ? If not the shortcuts are not that useful in form edits while the demand of our customers for keyboard shortcuts is considerable…
I was experiencing problems with data elements not updating. I solved this by using omitrecord and loadomittedrecords. I set the shortcuts in the solution open globally. Wondering if this is a valid workaround or problem. Thanks for all your help.
//global method for solution open
function SolutionOpen()
{
plugins.window.createShortcut('shift ENTER',globals.Shortcut);
plugins.window.createShortcut('shift ESCAPE',globals.Shortcut);
}
//global method
function Shortcut(event)
{
var form = currentcontroller.getName();
var shortcut = event.getType();
if(form.substr(0,3) == 'Dlg')//dialog shortcut keys
{
forms[form].controller.omitRecord();//use omit/load omit to have code recognize data element changes.Run into issues without this code.
forms[form].controller.loadOmittedRecords();
switch(shortcut)
{
case 'shift ENTER':
forms[form].OK();//call dialog Ok function
break;
case 'shift ESCAPE':
forms[form].Exit();//call dialog exit function
break;
default:
return;
}
}
else //non dialog forms
{
switch(shortcut)
{
case 'shift ENTER':
databaseManager.saveData();
break;
case 'shift ESCAPE':
application.closeForm();
break;
default:
return;
}
}
}
will not be updating to servoy 6 soon. Will adding the omitRecord and loadomittedRecords cause unforseen problems. All my test’s show that this will be a fix until I upgrade to version 6.