는 delGridRow
의 두 번째 매개 변수는 옵션을 사용하여 개체입니다, 그래서 당신은
jQuery('#category_grid').delGridRow(rows,{
errorTextFormat: function (data) {
if (data.responseText.substr(0, 6) == "<html ") {
return jQuery(data.responseText).html();
}
else {
return data.responseText;
// or
// return "Status: '" + data.statusText + "'. Error code: " +data.status;
}
}
});
당신이 errorTextFormat
기능에 의해 돌려 줄 텍스트 retText
을 다음과 같이 할 수있는 것 해당 div
의 jQuery.html(retText)
코드 내에서 delGridRow
코드의 오류 메시지 위치에 배치하십시오.
그런데 나는 delGridRow
함수를 직접 호출하지 않습니다. 그 대신에 navGrid
함수에 대해 jqGrid에 탐색 바를 추가하면 표준 "삭제 단추"에 대한 매개 변수로 내 errorTextFormat
함수를 제공합니다. 정확히 말해서 나는 $.jgrid.del
의와 관련하여 다음을 수행
jQuery.extend(jQuery.jgrid.del, {
ajaxDelOptions: { contentType: "application/json" },
mtype: "DELETE",
reloadAfterSubmit: false,
jqModal: false,
serializeDelData: function (postdata) {
return "";
},
errorTextFormat: function (data) {
if (data.responseText.substr(0, 6) == "<html ") {
return jQuery(data.responseText).html();
}
else {
return "Status: '" + data.statusText + "'. Error code: " + data.status;
}
}
});
이 (내 errorTextFormat
의 실제 코드는 좀 더 복잡한 것처럼 보이지만, 사용의 아이디어는 동일합니다).
감사합니다. 올레그, "errorTextFormat"에 대한 답변으로 내 문제를 해결했습니다. – vissu
@vissupepala : 안녕하세요! – Oleg