Commit 6c923eda authored by Piotr Gawron's avatar Piotr Gawron
Browse files

fix on refreshing data (page wasn't persisted)

parent 3b5d2ea0
Pipeline #4268 passed with stage
in 1 minute and 5 seconds
......@@ -91,11 +91,7 @@ MapsAdminPanel.prototype._createProjectTableRow = function () {
});
projectsRow.appendChild(projectsTable);
// noinspection JSUnusedGlobalSymbols
$(projectsTable).DataTable({
fnRowCallback: function (nRow, aData) {
nRow.setAttribute('id', aData[0]);
},
columns: [{
title: 'ProjectId'
}, {
......@@ -202,17 +198,18 @@ MapsAdminPanel.prototype.getHtmlStringLink = function (annotation) {
MapsAdminPanel.prototype.setProjects = function (projects) {
var self = this;
var dataTable = $($("[name='projectsTable']", self.getElement())[0]).DataTable();
var dataTable = $("[name='projectsTable']", self.getElement()).DataTable();
var data = [];
var page = dataTable.page();
for (var i = 0; i < projects.length; i++) {
var project = projects[i];
var rowData = self.projectToTableRow(project);
self.addUpdateListener(project, rowData);
data.push(rowData);
}
dataTable.clear().rows.add(data).draw();
dataTable.page(page).draw(false);
//it should be simplified, but I couldn't make it work
dataTable.clear().rows.add(data).page(page).draw(false).page(page).draw(false);
};
MapsAdminPanel.prototype.addUpdateListener = function (project, dataTableRow) {
......
......@@ -197,8 +197,8 @@ UsersAdminPanel.prototype.setUsers = function (users) {
self.addUpdateListener(user, rowData);
data.push(rowData);
}
dataTable.clear().rows.add(data).draw();
dataTable.page(page).draw(false);
//it should be simplified, but I couldn't make it work
dataTable.clear().rows.add(data).page(page).draw(false).page(page).draw(false);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment