0
내가 추가/편집 팝업에있는 jqGrid에서 사용하는 형태가있는 jqGrid를 클릭하면 편집 팝업에 입력
@using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { id = "formId" }))
{
//...
}
내가 그 형태가 열립니다 행을 클릭합니다. 텍스트 상자를 누르고 ENTER를 클릭하면이 양식이 제출됩니다. 그리고 jqgrid를 사용하지 않고 일반 게시물 요청으로 제출합니다. 하지만 저장 버튼을 클릭하면 필요에 따라 작동합니다.
buttons: {
'Save': function() {
if ($('#formId').valid()) {
$.ajax({
type: 'POST',
url: '@Url.Action("Action", "Controller")',
data: $('#formId').serialize(),
success: function (json) {
$("#grid").trigger("reloadGrid");
},
error: function (e) {
alert("Unable to save." + e);
},
dataType: "application/JSON"
});
$("#divForm").dialog('close');
}
},
하지만 저장 버튼을 클릭 할 때 Enter 키를 클릭하면됩니다. 다음
<div id="formContainer">
@using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { id = "formId" }))
{
...
}
</div>
과 :
$('#formContainer').delegate('#formId', 'submit', function (evt) {
evt.preventDefault();
if ($(this).valid()) {
$.ajax({
type: this.method,
url: this.action,
data: $(this).serialize(),
success: function (json) {
$('#grid').trigger("reloadGrid");
},
error: function (e) {
alert("Unable to save." + e);
},
});
}
});
지금 Save
버튼에서 양식 제출 강제 클릭
'Save': function() {
$('#formId').submit();
}
을 폼의 제출 이벤트에 대한 가입