Hello.
My sentence can be weird because I used a translator.
Please excuse me.
There is no problem when there is more than one search result.
I didn't ask for so many requests in a row.
When there are zero search results, the request is automatically generated continuously.
This is my code.
I don't know how to use JSfiddle, and I can't provide JSfiddle because my development environment is still only done locally.
function funcMainComplete(evt, ui) {
var rowIndxPage;
if ($("#hidMainRowIndxPage").val() == "" || $("#hidMainRowIndxPage").val() == undefined) {
rowIndxPage = 0;
} else {
rowIndxPage = Number(rowIndxPage);
}
this.setSelection({ rowIndxPage: rowIndxPage });
}
function funcMainRowSelect(evt, ui) {
if (ui.addList.length > 0) {
$("#hidUk").val(ui.addList[0].rowData[0]);
$("#hidMainRowIndxPage").val(ui.addList[0].rowIndxPage);
$("#btnSave").data("mode", "U");
$("#btnDelete").prop("disabled", false).removeClass("disabled");
}
}
$(document).ready(function () {
var gridObj_Provider = {
showTop: false,
locale: "ko",
selectionModel: {
type: "row",
mode: "single",
toggle: false
},
scrollModel: {
autoFit: true
},
pageModel: {
type: "remote",
rPP: 15,
rPPOptions: [15, 30, 50, 100, 1000, 10000]
},
editable: false,
complete: funcMainComplete,
hWrap: false,
wrap: false,
height: 630,
dataModel: {
location: "remote",
recIndx: "0",
dataType: "JSON",
contentType: "application/json; charset=utf-8",
url: "/Proc/QbGrid.aspx",
getData: function (response) {
return {
curPage: response.Data.CurPage,
totalRecords: response.Data.TotalRecords,
data: response.Data.List
};
},
postData: function () {
var obj = {
gubun: "R",
qbgrid_query_template_code: "Provider",
};
var searchConditionArr = $("#frmSearch").children().get();
if (searchConditionArr.length > 0) {
searchConditionArr.forEach(function (el) {
obj[$(el).attr("name")] = $(el).val();
});
}
return obj;
},
error: function (jqXHR, textStatus, errorThrown) {
console.log("error");
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
}
},
colModel: [{
dataIndx: "state",
maxWidth: 30,
minWidth: 30,
align: "center",
resizable: false,
hidden: true,
title: "",
menuIcon: false,
type: "checkbox",
cls: "ui-state-default",
sortable: false,
editor: false,
dataType: "bool",
cb: {
all: false, //checkbox selection in the header affect current page only.
header: true //show checkbox in header.
}
},
{
dataIndx: "0",
hidden: "true"
},
{
title: "코드",
dataType: "string",
dataIndx: "1",
hidden: false,
halign: "center",
align: "center",
hvalign: "center",
valign: "center"
},
{
title: "공급사명",
dataType: "string",
dataIndx: "2",
hidden: false,
halign: "center",
align: "center",
hvalign: "center",
valign: "center"
},
{
title: "연락처",
dataType: "string",
dataIndx: "3",
hidden: false,
halign: "center",
align: "center",
hvalign: "center",
valign: "center"
}
],
rowSelect: funcMainRowSelect,
hoverMode: "row"
};
var qbgrid_Provider = pq.grid("#divQbgrid_Provider", gridObj_Provider);
});
Please include the localization file and this is controlled by the localization string: strNoRows.
I am using the localization file.
I just want to prevent data requests from occurring continuously when there are zero search results.
Thank you.