From 7ae7e05f14d283872ee5cda0ce1c5d0479aa7091 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 19 Oct 2020 09:29:39 -0500 Subject: [PATCH] roughin ajax call in event.js for server side pagination --- web/skins/classic/views/js/events.js | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/web/skins/classic/views/js/events.js b/web/skins/classic/views/js/events.js index 015d41a01..848ba23c3 100644 --- a/web/skins/classic/views/js/events.js +++ b/web/skins/classic/views/js/events.js @@ -8,6 +8,49 @@ var downloadBtn = $j('#downloadBtn'); var deleteBtn = $j('#deleteBtn'); var table = $j('#eventTable'); +/* +This is the format of the json object sent by bootstrap-table + +var params = +{ +"type":"get", +"data": + { + "search":"some search text", + "sort":"StartTime", + "order":"asc", + "offset":0, + "limit":25 + "filter": + { + "Name":"some advanced search text" + "StartTime":"some more advanced search text" + } + }, +"cache":true, +"contentType":"application/json", +"dataType":"json" +}; +*/ + +// Called by bootstrap-table to retrieve zm event data +function ajaxRequest(params) { + $j.getJSON(thisUrl + '?view=request&request=events&task=query', params.data) + .done(function(data) { + //console.log('Ajax parameters: ' + JSON.stringify(params)); + // rearrange the result into what bootstrap-table expects + var rows = processRows(data.rows); + params.success({total: data.total, totalNotFiltered: data.totalNotFiltered, rows: rows}); + }) + .fail(logAjaxFail); +} + +function processRows(rows) { + // TO-DO: Inject desired html for the cells in each row + + return rows; +} + function thumbnail_onmouseover(event) { var img = event.target; img.src = '';