I have been using JTable in my aspx pages and all seems well, but on a certain content page, when I try to edit or Add an item in Jtable, and by default I press Enter, the UI becomes vague. Before pressing Enter while Updating Jtable row.

All I want is to when I click Enter, submit jtable , simulate click on Save button on edit and create form.

I can use this:

formCreated: function (event, data) {
    data.form.find('input[type="text"]').keydown(function (event) {
        if (event.keyCode == 13) {
            $('#AddRecordDialogSaveButton').click();
            $('#EditDialogSaveButton').click();
            event.preventDefault();
            return false;
        }
    })
}

but I must copy that on every jquery jtable form. Is there any simplest way?

有帮助吗?

解决方案

I love to share my solution for this problem whit all people who need this:

$(window).keydown(function (event) {
if (event.keyCode == 13) {
    event.preventDefault();
    $('#AddRecordDialogSaveButton').click();
    $('#EditDialogSaveButton').click();
    return false;
}
});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top