use ajax instead of getJson so we can specify no timeout. Ensure no concurrent ajax queries
parent
d951173388
commit
141dcc07fe
|
@ -1,7 +1,8 @@
|
||||||
var backBtn = $j('#backBtn');
|
const backBtn = $j('#backBtn');
|
||||||
var exportBtn = $j('#exportBtn');
|
const exportBtn = $j('#exportBtn');
|
||||||
var deleteBtn = $j('#deleteBtn');
|
const deleteBtn = $j('#deleteBtn');
|
||||||
var table = $j('#snapshotTable');
|
const table = $j('#snapshotTable');
|
||||||
|
var ajax = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is the format of the json object sent by bootstrap-table
|
This is the format of the json object sent by bootstrap-table
|
||||||
|
@ -30,17 +31,25 @@ var params =
|
||||||
|
|
||||||
// Called by bootstrap-table to retrieve zm event data
|
// Called by bootstrap-table to retrieve zm event data
|
||||||
function ajaxRequest(params) {
|
function ajaxRequest(params) {
|
||||||
|
if (ajax) ajax.abort();
|
||||||
|
|
||||||
if ( params.data && params.data.filter ) {
|
if ( params.data && params.data.filter ) {
|
||||||
params.data.advsearch = params.data.filter;
|
params.data.advsearch = params.data.filter;
|
||||||
delete params.data.filter;
|
delete params.data.filter;
|
||||||
}
|
}
|
||||||
$j.getJSON(thisUrl + '?view=request&request=snapshots&task=query', params.data)
|
ajax = $j.ajax({
|
||||||
|
url: thisUrl + '?view=request&request=snapshots&task=query',
|
||||||
|
data: params.data,
|
||||||
|
timeout: 0
|
||||||
|
})
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
|
ajax = null;
|
||||||
var rows = processRows(data.rows);
|
var rows = processRows(data.rows);
|
||||||
// rearrange the result into what bootstrap-table expects
|
// rearrange the result into what bootstrap-table expects
|
||||||
params.success({total: data.total, totalNotFiltered: data.totalNotFiltered, rows: rows});
|
params.success({total: data.total, totalNotFiltered: data.totalNotFiltered, rows: rows});
|
||||||
})
|
})
|
||||||
.fail(function(jqXHR) {
|
.fail(function(jqXHR) {
|
||||||
|
ajax = null;
|
||||||
logAjaxFail(jqXHR);
|
logAjaxFail(jqXHR);
|
||||||
table.bootstrapTable('refresh');
|
table.bootstrapTable('refresh');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue