If you are in a long Grid-Edit page, it’s cumbersome to have to press Ctrl-Home/End and then click the Grid-Save button. And then you lose your original position and have to find your way back.Since Javascript supports onkeydown, how do I submit the Grid-Edit form when pressing F8? Then rely on Toast message to report Save/Update Sucess!This is the Grid-Save button HTML:SaveI only used before so I’m not sure what to do here.How do I submit this Grid-Edit form with Javascript?
Assume you want to save Grid-Edit in suppliers table of demo2023 project, then you may simply use this code in Startup Script of List Page:
$('.ew-grid-save').on('click',function() {
ew.alert('Form will be submitted on click event of Save button in Grid-Edit mode'); // just to test
$("#fsupplierslist").submit();
});
konfuzion wrote:
Since Javascript supports onkeydown…
You may write your handler for “keydown” event in Startup Script, read:
[STARTUP SCRIPT]
$(document).on('keydown',function(event) {
if (event.code === 'F8') // or keycode 0x0042
{
ew.alert('F8 is pressed.'); // just to test
}
});
Still not working…
I see now, I need to click into a input text box and have the cursor blinking in it, then press F8 to trigger the javascript keydown function.
It should work also when you have just loaded the Grid-Edit mode in List Page. No need to make textbox control must be get focus.